This project builds a searchable memory bank from your Facebook export and exposes it as an MCP tool for LM Studio.
Works similar to the Black Mirror episode, if you're a fan of that show, where it takes everything a person has posted on social media and turns that data into a version of them you can directly interact with.
Although dark and possibly not recommended, you can even 'resurrect' a person who has died (assuming you have access to their facebook account) to comfort those in mourning.
The current workflow is config-driven and supports both posts and comments:
1_prep_data.pyreads Facebook files fromconfig.json, cleans text, removes emoji/mojibake, and writes:cleaned_posts.jsoncleaned_comments.json
2_build_memory.pyimports posts, comments, or both, then builds:- Chroma vector DB in
avatar_memory_db/ - Full-document index in
avatar_memory_db/document_index.json
- Chroma vector DB in
3_avatar_mcp.pyservessearch_my_memory, combining semantic search with recency scoring.
1_prep_data.py: Data cleaning and normalization.2_build_memory.py: Embedding + Chroma build pipeline.3_avatar_mcp.py: MCP server and retrieval logic.config.json: Central configuration for paths, embeddings, memory DB, and search scoring.
Install the current dependencies in your virtual environment:
pip install -r requirements.txtEquivalent explicit package list:
pip install mcp chromadb requests langchain-openai langchain-core langchain-community langchain-text-splittersBy default, config.json expects Facebook export files under:
facebook_data/your_facebook_activity/posts/your_posts__check_ins__photos_and_videos_*.jsonfacebook_data/your_facebook_activity/comments_and_reactions/comments.json
If your export is in a different location or filename pattern, update config.json.
Before building or querying memory:
- Open LM Studio.
- Start the Local Server.
- Load the embedding model configured in
config.json(default:nomic-embed-text). - Confirm the base URL matches
embeddings.api_base(default:http://localhost:1234/v1).
Process both posts and comments:
python 1_prep_data.py --mode bothOr run a subset:
python 1_prep_data.py --mode posts
python 1_prep_data.py --mode commentsRun:
python 2_build_memory.pyWhen prompted, choose:
1posts only2comments only3both
Non-interactive example (both):
printf "3\n" | python 2_build_memory.pyIf memory_db.wipe_existing_on_rebuild is true (default), the old DB is removed before rebuilding.
python 3_avatar_mcp.pyThe MCP tool exposed is search_my_memory(topic, num_results=...).
3_avatar_mcp.py ranks results by:
- semantic similarity from embeddings
- recency boost using exponential decay
Tune behavior in config.json:
search.default_num_resultssearch.candidate_multipliersearch.recency_half_life_dayssearch.recency_weight_alpha
- LM Studio connection errors:
- Ensure the Local Server is running.
- Verify
embeddings.api_baseand model name inconfig.json.
- No memory results:
- Confirm
cleaned_posts.jsonand/orcleaned_comments.jsonexist. - Re-run
python 1_prep_data.py --mode bothand rebuild.
- Confirm
- Collection or DB errors:
- Rebuild with
python 2_build_memory.py. - Check
memory_db.pathandmemory_db.collection_nameinconfig.json.
- Rebuild with
- Long build times:
- Large exports can take 20-60+ minutes depending on machine and model throughput.