memoreei 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. memoreei-0.2.0/.coverage +0 -0
  2. memoreei-0.2.0/.env.example +50 -0
  3. memoreei-0.2.0/.gitignore +28 -0
  4. memoreei-0.2.0/CLAUDE.md +42 -0
  5. memoreei-0.2.0/CONTRIBUTING.md +61 -0
  6. memoreei-0.2.0/DEMO.md +105 -0
  7. memoreei-0.2.0/Dockerfile +10 -0
  8. memoreei-0.2.0/PKG-INFO +638 -0
  9. memoreei-0.2.0/PROGRESS.md +32 -0
  10. memoreei-0.2.0/README.md +593 -0
  11. memoreei-0.2.0/TODO.md +37 -0
  12. memoreei-0.2.0/data/samples/whatsapp_donut_heist.txt +63 -0
  13. memoreei-0.2.0/data/samples/whatsapp_pizza_wars.txt +56 -0
  14. memoreei-0.2.0/data/samples/whatsapp_printer_conspiracy.txt +53 -0
  15. memoreei-0.2.0/docker-compose.yml +9 -0
  16. memoreei-0.2.0/docs/architecture.md +150 -0
  17. memoreei-0.2.0/docs/connectors.md +255 -0
  18. memoreei-0.2.0/docs/deployment.md +168 -0
  19. memoreei-0.2.0/examples/basic_search.py +18 -0
  20. memoreei-0.2.0/examples/discord_bot.py +61 -0
  21. memoreei-0.2.0/pyproject.toml +62 -0
  22. memoreei-0.2.0/run_tasks.sh +272 -0
  23. memoreei-0.2.0/scripts/demo_setup.sh +177 -0
  24. memoreei-0.2.0/scripts/discord_post.sh +52 -0
  25. memoreei-0.2.0/scripts/refresh.sh +22 -0
  26. memoreei-0.2.0/scripts/seed_data.py +73 -0
  27. memoreei-0.2.0/scripts/seed_discord.py +105 -0
  28. memoreei-0.2.0/scripts/test_discord_sync.py +83 -0
  29. memoreei-0.2.0/scripts/test_historical_search.py +46 -0
  30. memoreei-0.2.0/scripts/test_live_message.py +85 -0
  31. memoreei-0.2.0/scripts/test_mcp_e2e.py +177 -0
  32. memoreei-0.2.0/scripts/test_negative_search.py +54 -0
  33. memoreei-0.2.0/src/memoreei/__init__.py +0 -0
  34. memoreei-0.2.0/src/memoreei/cli.py +490 -0
  35. memoreei-0.2.0/src/memoreei/config.py +108 -0
  36. memoreei-0.2.0/src/memoreei/connectors/__init__.py +23 -0
  37. memoreei-0.2.0/src/memoreei/connectors/base.py +37 -0
  38. memoreei-0.2.0/src/memoreei/connectors/discord_connector.py +206 -0
  39. memoreei-0.2.0/src/memoreei/connectors/discord_package_connector.py +274 -0
  40. memoreei-0.2.0/src/memoreei/connectors/email_connector.py +323 -0
  41. memoreei-0.2.0/src/memoreei/connectors/generic_connector.py +327 -0
  42. memoreei-0.2.0/src/memoreei/connectors/imessage_connector.py +245 -0
  43. memoreei-0.2.0/src/memoreei/connectors/instagram_connector.py +189 -0
  44. memoreei-0.2.0/src/memoreei/connectors/mastodon_connector.py +156 -0
  45. memoreei-0.2.0/src/memoreei/connectors/matrix_connector.py +217 -0
  46. memoreei-0.2.0/src/memoreei/connectors/messenger_connector.py +206 -0
  47. memoreei-0.2.0/src/memoreei/connectors/signal_connector.py +454 -0
  48. memoreei-0.2.0/src/memoreei/connectors/slack_connector.py +210 -0
  49. memoreei-0.2.0/src/memoreei/connectors/sms_connector.py +127 -0
  50. memoreei-0.2.0/src/memoreei/connectors/telegram_connector.py +204 -0
  51. memoreei-0.2.0/src/memoreei/connectors/whatsapp.py +122 -0
  52. memoreei-0.2.0/src/memoreei/py.typed +0 -0
  53. memoreei-0.2.0/src/memoreei/search/__init__.py +0 -0
  54. memoreei-0.2.0/src/memoreei/search/embeddings.py +96 -0
  55. memoreei-0.2.0/src/memoreei/search/hybrid.py +97 -0
  56. memoreei-0.2.0/src/memoreei/server.py +427 -0
  57. memoreei-0.2.0/src/memoreei/storage/__init__.py +0 -0
  58. memoreei-0.2.0/src/memoreei/storage/database.py +454 -0
  59. memoreei-0.2.0/src/memoreei/storage/models.py +61 -0
  60. memoreei-0.2.0/src/memoreei/sync_manager.py +112 -0
  61. memoreei-0.2.0/src/memoreei/tools/__init__.py +0 -0
  62. memoreei-0.2.0/src/memoreei/tools/memory_tools.py +275 -0
  63. memoreei-0.2.0/tests/__init__.py +0 -0
  64. memoreei-0.2.0/tests/conftest.py +33 -0
  65. memoreei-0.2.0/tests/test_config.py +161 -0
  66. memoreei-0.2.0/tests/test_connectors.py +77 -0
  67. memoreei-0.2.0/tests/test_discord.py +87 -0
  68. memoreei-0.2.0/tests/test_discord_package.py +301 -0
  69. memoreei-0.2.0/tests/test_generic_import.py +379 -0
  70. memoreei-0.2.0/tests/test_historical_search.py +91 -0
  71. memoreei-0.2.0/tests/test_imessage.py +391 -0
  72. memoreei-0.2.0/tests/test_instagram.py +189 -0
  73. memoreei-0.2.0/tests/test_mcp_e2e.py +169 -0
  74. memoreei-0.2.0/tests/test_messenger.py +255 -0
  75. memoreei-0.2.0/tests/test_negative_search.py +105 -0
  76. memoreei-0.2.0/tests/test_search.py +113 -0
  77. memoreei-0.2.0/tests/test_signal.py +496 -0
  78. memoreei-0.2.0/tests/test_sms.py +198 -0
  79. memoreei-0.2.0/tests/test_storage.py +134 -0
  80. memoreei-0.2.0/tests/test_whatsapp_parser.py +79 -0
Binary file
@@ -0,0 +1,50 @@
1
+ # ══════════════════════════════════════════════════════════════
2
+ # Memoreei Configuration
3
+ # Copy to .env and uncomment/fill values you need
4
+ # ══════════════════════════════════════════════════════════════
5
+
6
+ # ── Core ─────────────────────────────────────────────────────
7
+ MEMOREEI_DB_PATH=./memoreei.db
8
+ EMBEDDING_PROVIDER=fastembed
9
+ # OPENAI_API_KEY=sk-... # only if EMBEDDING_PROVIDER=openai
10
+
11
+ # ── Auto Sync (optional) ─────────────────────────────────────
12
+ # MEMOREEI_AUTO_SYNC=false
13
+ # MEMOREEI_SYNC_INTERVAL=300 # seconds between background syncs
14
+
15
+ # ── Discord (live API sync) ──────────────────────────────────
16
+ # DISCORD_BOT_TOKEN=
17
+ # DISCORD_CHANNEL_ID=
18
+
19
+ # ── Telegram ─────────────────────────────────────────────────
20
+ # TELEGRAM_BOT_TOKEN=
21
+ # TELEGRAM_CHAT_ID=
22
+
23
+ # ── Slack ────────────────────────────────────────────────────
24
+ # SLACK_BOT_TOKEN=
25
+ # SLACK_CHANNEL_ID=
26
+
27
+ # ── Matrix ───────────────────────────────────────────────────
28
+ # MATRIX_HOMESERVER=https://matrix.org
29
+ # MATRIX_ACCESS_TOKEN=
30
+ # MATRIX_ROOM_ID=
31
+
32
+ # ── Mastodon ─────────────────────────────────────────────────
33
+ # MASTODON_INSTANCE=https://mastodon.social
34
+ # MASTODON_HASHTAG=
35
+ # MASTODON_ACCESS_TOKEN=
36
+
37
+ # ── Gmail (IMAP) ─────────────────────────────────────────────
38
+ # GMAIL_EMAIL=
39
+ # GMAIL_APP_PASSWORD=
40
+
41
+ # ── iMessage (macOS only, local DB read) ─────────────────────
42
+ # IMESSAGE_DB_PATH=~/Library/Messages/chat.db
43
+
44
+ # ── Signal Desktop (local encrypted DB) ──────────────────────
45
+ # SIGNAL_DB_PATH= # auto-detected if blank
46
+ # SIGNAL_CONFIG_PATH= # auto-detected if blank
47
+
48
+ # ── TMDB (for Movie Ring example app) ────────────────────────
49
+ # TMDB_API_KEY=
50
+ # TMDB_READ_TOKEN=
@@ -0,0 +1,28 @@
1
+ .env
2
+ *.db
3
+ *.db-shm
4
+ *.db-wal
5
+ __pycache__/
6
+ *.py[cod]
7
+ *.pyo
8
+ .venv/
9
+ venv/
10
+ env/
11
+ dist/
12
+ build/
13
+ *.egg-info/
14
+ .pytest_cache/
15
+ .mypy_cache/
16
+ .ruff_cache/
17
+ *.so
18
+ node_modules/
19
+ .DS_Store
20
+ logs/
21
+ .internal/
22
+ .mcp.json
23
+ ralph.env
24
+ REFACTOR_PLAN.md
25
+ ENTRY.md
26
+ PLAN.md
27
+ TASK.md
28
+ tasks.json
@@ -0,0 +1,42 @@
1
+ # CLAUDE.md — Memoreei Project Context
2
+
3
+ ## What This Is
4
+ Memoreei is an MCP server for personal memory search. It ingests messages from Discord, WhatsApp, Telegram, Matrix, Slack, Gmail, and more — stores them in a hybrid search database (keyword + vector) — and exposes them via MCP tools.
5
+
6
+ ## MCP Tools Available
7
+ You have these tools via the `memoreei` MCP server:
8
+
9
+ | Tool | What it does |
10
+ |------|-------------|
11
+ | `sync_discord` | Pull messages from Discord channel into memory DB |
12
+ | `search_memory` | Hybrid keyword + semantic search across all sources |
13
+ | `get_context` | Get surrounding messages around a search hit |
14
+ | `add_memory` | Manually store a note or fact |
15
+ | `list_sources` | Show all ingested sources with message counts |
16
+ | `ingest_whatsapp` | Import a WhatsApp chat export .txt file |
17
+
18
+ ## How to Use
19
+ - **To search:** Use `search_memory` with a natural language query. It does hybrid BM25 + vector search with RRF fusion.
20
+ - **To sync Discord:** Use `sync_discord` — it reads the bot token and channel from .env automatically.
21
+ - **To get context around a result:** Use `get_context` with the memory ID from search results.
22
+ - **To see what's ingested:** Use `list_sources`.
23
+
24
+ ## DO NOT
25
+ - Do NOT try to access Discord APIs directly or unlock Bitwarden — the MCP tools handle everything.
26
+ - Do NOT use `bw` commands. The server has its own credentials in `.env`.
27
+
28
+ ## Project Structure
29
+ ```
30
+ src/memoreei/
31
+ ├── server.py # MCP server (FastMCP, stdio)
32
+ ├── storage/database.py # SQLite + FTS5 + vector search
33
+ ├── search/hybrid.py # Hybrid search with RRF fusion
34
+ ├── connectors/ # Discord, WhatsApp, Telegram, Matrix, Slack, Email
35
+ └── tools/memory_tools.py # MCP tool implementations
36
+ ```
37
+
38
+ ## Key Paths
39
+ - **DB:** `./memoreei.db` (SQLite + FTS5)
40
+ - **Venv:** `.venv/bin/python`
41
+ - **Config:** `.env` (tokens, channel IDs)
42
+ - **MCP config:** `.mcp.json` (also in `~/.claude/settings.json`)
@@ -0,0 +1,61 @@
1
+ # Contributing to Memoreei
2
+
3
+ Welcome! Memoreei is a personal memory search server that ingests messages from Discord, WhatsApp, Telegram, Matrix, Slack, and Gmail into a hybrid search database. Contributions are appreciated.
4
+
5
+ ## Dev Environment Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/your-fork/memoreei.git
9
+ cd memoreei
10
+ python -m venv .venv
11
+ source .venv/bin/activate
12
+ pip install -e '.[dev]'
13
+ ```
14
+
15
+ Copy `.env.example` to `.env` and fill in any credentials you want to test with:
16
+
17
+ ```bash
18
+ cp .env.example .env
19
+ ```
20
+
21
+ ## Running Tests
22
+
23
+ ```bash
24
+ pytest
25
+ ```
26
+
27
+ With coverage:
28
+
29
+ ```bash
30
+ pytest --cov=src/memoreei --cov-report=term-missing
31
+ ```
32
+
33
+ Tests use `pytest-asyncio` (auto mode). All tests run against a fresh in-memory SQLite database per test — no external services required.
34
+
35
+ ## Code Style
36
+
37
+ - **Type hints** on all function signatures
38
+ - **Docstrings** on public classes and non-trivial methods
39
+ - **Async** throughout — all I/O is async
40
+ - Keep functions focused; prefer small composable pieces over large methods
41
+
42
+ No formatter is enforced yet, but aim for PEP 8 style. A simple `ruff check src/` before submitting is appreciated.
43
+
44
+ ## Adding a New Connector
45
+
46
+ See [docs/connectors.md](docs/connectors.md) for a step-by-step guide. The short version:
47
+
48
+ 1. Create `src/memoreei/connectors/yourplatform_connector.py` implementing `BaseConnector`
49
+ 2. Register it in `src/memoreei/connectors/__init__.py`
50
+ 3. Add config fields to `src/memoreei/config.py`
51
+ 4. Add an MCP tool in `src/memoreei/server.py`
52
+ 5. Write tests in `tests/test_yourplatform.py`
53
+
54
+ ## PR Process
55
+
56
+ 1. Fork the repo and create a branch: `git checkout -b feat/my-feature`
57
+ 2. Make your changes and add tests
58
+ 3. Ensure `pytest` passes
59
+ 4. Open a pull request with a clear description of what it does and why
60
+
61
+ Keep PRs focused — one feature or fix per PR makes review easier. If you're unsure about scope or approach, open an issue first.
memoreei-0.2.0/DEMO.md ADDED
@@ -0,0 +1,105 @@
1
+ # Memoreei — Live Demo Script (3 minutes)
2
+
3
+ ## Pre-Demo Setup
4
+
5
+ Run this before going on screen:
6
+
7
+ ```bash
8
+ bash scripts/demo_setup.sh
9
+ ```
10
+
11
+ It will seed the database if empty, verify the MCP server starts, and print a readiness checklist.
12
+
13
+ **What should be visible:**
14
+ - Claude Code open with Memoreei MCP server connected (`.mcp.json` in project root)
15
+ - Discord `#memoreei-demo` channel visible
16
+ - Terminal ready for ad-hoc commands if needed
17
+
18
+ ---
19
+
20
+ ## The Demo
21
+
22
+ ### Opening (15 sec)
23
+
24
+ > "This is Memoreei — a personal memory server. It ingests your conversations from anywhere — Discord, Telegram, WhatsApp, email — and makes them searchable by any AI model through MCP."
25
+
26
+ ### Architecture (15 sec)
27
+
28
+ > "It's not a chatbot. It's infrastructure. Any MCP client connects to it — Claude Code, Cursor, your own apps. Your data stays local. Embeddings run locally via ONNX. No cloud, no API keys required."
29
+
30
+ ### Live Discord Demo (60 sec)
31
+
32
+ 1. Switch to Discord — show `#memoreei-demo` with existing bot conversation
33
+ 2. **Type a new message** in the channel:
34
+ > *"Hey everyone, I just found out that the secret ingredient in grandma's cookies is actually cardamom"*
35
+ 3. Switch to Claude Code
36
+ 4. Say: **"Sync my Discord and tell me what people have been talking about"**
37
+ - Claude calls `sync_discord` → picks up all messages including the one just typed
38
+ - Claude calls `search_memory` → summarizes the conversation
39
+ 5. Say: **"What was the secret ingredient I just mentioned?"**
40
+ - Returns: *"cardamom"* — with the exact message and timestamp
41
+ - *This is the money shot — real-time memory from a message typed 30 seconds ago*
42
+
43
+ ### Multi-Source Search (45 sec)
44
+
45
+ 6. Say: **"Search all my memories for anything about movies"**
46
+ - Returns results across Discord, WhatsApp, and manual notes — multiple sources, one query
47
+ 7. Say: **"Who have I been talking to the most this week?"**
48
+ - Returns participant stats fused across sources
49
+
50
+ ### Show Sources (15 sec)
51
+
52
+ 8. Say: **"List all my memory sources"**
53
+ - Shows each source with message counts: `discord:...`, `whatsapp:...`, `manual`
54
+ > *"One server. Every conversation. Any AI client."*
55
+
56
+ ### Use Case Flash (if time — 15 sec)
57
+
58
+ - Quick flash of the Movie Ring web app or Memory Search UI
59
+ > "Because it's an MCP server, anything can build on top of it. This web app scans conversations for movie mentions and shows what my friends are recommending."
60
+
61
+ ### Close (15 sec)
62
+
63
+ > "Memoreei. Your AI's long-term memory. Local-first, open source, and on GitHub right now."
64
+ >
65
+ > Drop the repo link.
66
+
67
+ ---
68
+
69
+ ## Backup Plans
70
+
71
+ | Problem | Recovery |
72
+ |---------|----------|
73
+ | Claude Code is slow | Have pre-run query results ready to paste |
74
+ | Discord sync fails | WhatsApp data is already seeded — search `whatsapp:printer_conspiracy` |
75
+ | Embeddings slow on first sync | "First sync downloads the model — here's one I prepared earlier" → show pre-populated results |
76
+ | MCP server not connected | Run `bash scripts/demo_setup.sh` and reconnect in Claude Code settings |
77
+
78
+ ---
79
+
80
+ ## MCP Tools Reference
81
+
82
+ | Tool | What it does |
83
+ |------|-------------|
84
+ | `sync_discord` | Pull new messages from Discord channel into memory |
85
+ | `search_memory` | Hybrid keyword + semantic search across all sources |
86
+ | `get_context` | Fetch surrounding messages around a memory hit |
87
+ | `add_memory` | Manually store a note or fact |
88
+ | `list_sources` | Show all ingested sources with message counts |
89
+ | `ingest_whatsapp` | Import a WhatsApp chat export `.txt` file |
90
+
91
+ ---
92
+
93
+ ## Key Phrases to Hit
94
+
95
+ - "Not a chatbot — it's infrastructure"
96
+ - "Any MCP client can connect"
97
+ - "Your data stays local"
98
+ - "Real-time ingestion"
99
+ - "Open source"
100
+
101
+ ## Words to Avoid
102
+
103
+ - "RAG" — just show it working
104
+ - "Basic" anything
105
+ - Explaining vector databases — the demo speaks for itself
@@ -0,0 +1,10 @@
1
+ FROM python:3.12-slim
2
+ WORKDIR /app
3
+ COPY pyproject.toml .
4
+ COPY src/ src/
5
+ COPY data/ data/
6
+ RUN pip install --no-cache-dir .
7
+ ENV MEMOREEI_DB_PATH=/data/memoreei.db
8
+ VOLUME /data
9
+ ENTRYPOINT ["memoreei"]
10
+ CMD ["serve"]