x-archive-rag

by mameshivaa

Not rated
GitHub

About

Local-first MCP tools for searching and drafting from your X/Twitter archive.

Details

Author
mameshivaa
Categories
AI, Other, Search, Knowledge Base

Setup

Install x-archive-rag in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/mameshivaa/x-archive-rag

Follow the installation instructions in the repository README, then restart your MCP client.

Turn your X/Twitter archive into a local AI memory layer.

Unlike uploading a ZIP to ChatGPT,x-archive-ragconverts your archive into reusable local infrastructure: SQLite storage, repeatable retrieval, citation IDs, persona profiling, grounded draft prompts, a local web UI, and MCP tools that AI clients can query without receiving your whole archive.

The default workflow keeps your archive local. You decide when to export data or send a small retrieved evidence set to an OpenAI-compatible model.

If this is useful for your personal AI or MCP workflow, starring the repository helps other people find it:https://github.com/mameshivaa/x-archive-rag

x-archive-ragis not a bigger prompt. It is a small local data layer for your archive.

Run it locally after importing an archive:

x-archive-rag web --db ./memory.sqlite --open

Try the UI with the included sample archive before touching private data:

git clone https://github.com/mameshivaa/x-archive-rag.git cd x-archive-rag python3 -m pip install -e . x-archive-rag demo --open

- Import your official X archive ZIP or extracted directory into a local SQLite database.
- Search it with keyword, semantic, or hybrid retrieval.
- Generate a persona profile from your own posts.
- Build citation-grounded draft prompts that show the tweets used as evidence.
- Expose the same local memory to AI clients through MCP tools.

The main interface is a small CLI with nine commands:

- ingestturns an archive into a reusable local database.
- searchretrieves relevant posts with citation IDs.
- profilesummarizes recurring topics, tone, and writing patterns.
- draftbuilds a grounded prompt from retrieved evidence.
- mcpexposes the same memory to AI clients that support MCP.
- webruns a local browser UI for search, profile inspection, and draft prompts.
- democreates a sample database and can open the local web UI.
- doctorchecks whether a database is ready for search, draft, and MCP use.
- exportwrites imported tweets as JSONL or Markdown for inspection and reuse.

Text output is designed for humans. JSON and Markdown output are designed for scripts, agents, and repeatable workflows.

Alpha. The current release is intentionally small:

- Importtweets.js/tweet.jsfrom an extracted archive directory or archive ZIP, including common long-form tweet text fields and expanded URL entities.
- Store normalized tweets in SQLite.
- Search with SQLite FTS5, dependency-free semantic retrieval, or hybrid retrieval.
- Generate a persona profile from your own posts.
- Build grounded RAG prompts with cited tweets.
- Expose archive search and draft prompts through a minimal MCP stdio server.
- Optionally call OpenAI-compatible chat completions usingOPENAI_API_KEY.

Most archive tools help you search old posts. This project focuses on a different workflow:

"Given what I have said before, draft something that sounds like me, while showing the evidence."

The assistant is designed for drafting and reflection, not impersonation or automated posting.

Uploading a ZIP is a one-off context dump.x-archive-ragis a reusable memory layer.

For a deeper technical comparison, seedocs/comparison.md.

Want to test without private archive data first?

x-archive-rag ingest ./twitter-archive.zip --db ./memory.sqlite x-archive-rag profile --db ./memory.sqlite x-archive-rag search "personal AI memory" --db ./memory.sqlite --mode hybrid x-archive-rag draft "What do I think about OSS personal AI?" --db ./memory.sqlite x-archive-rag web --db ./memory.sqlite --open

Use the sections below when you need more control over import format, date filters, exports, OpenAI-compatible calls, or MCP.

Want the Claude Desktop Extension artifact instead? Download the latest.mcpbfromReleasesand followdocs/mcpb.md.

AI coding agents and MCP marketplace reviewers can start fromllms.txtorllms-install.md.

Prefer a browser surface? Run the local web UI and followdocs/web.md.

Import an extracted X archive directory:

x-archive-rag ingest ./twitter-archive --db ./x-archive-rag.sqlite

Retweets are excluded by default so profiles and drafts focus on your own statements. Add--include-retweetsif you want to index retweets too.

x-archive-rag ingest ./twitter-archive.zip --db ./x-archive-rag.sqlite
x-archive-rag search "AI agents and personal tools" --db ./x-archive-rag.sqlite

Search and draft outputs include citation IDs such asT1, so generated text can refer back to specific retrieved posts.

[T1] 2024-01-01T12:00:00+00:00 https://x.com/i/web/status/1001 Personal AI should be local-first and cite the memories it uses.
x-archive-rag search "AI agents and personal tools" \ --db ./x-archive-rag.sqlite \ --json

Semantic and hybrid search are available without external services:

x-archive-rag search "grounded memory for drafts" \ --db ./x-archive-rag.sqlite \ --mode hybrid

Limit retrieval to a time range when older views should not influence a draft:

x-archive-rag search "personal AI" \ --db ./x-archive-rag.sqlite \ --since 2024-01-01 \ --until 2024-12-31
x-archive-rag profile --db ./x-archive-rag.sqlite

Profiles include the number of tweets analyzed and the covered date range.

x-archive-rag draft "What do I think about OSS personal AI?" \ --db ./x-archive-rag.sqlite \ --mode hybrid \ --output ./draft.md

The draft command builds an evidence-grounded prompt. It does not call a remote model unless--call-openaiis set.

Retrieved tweets: [T1] 2024-01-01T12:00:00+00:00 https://x.com/i/web/status/1001 Personal AI should be local-first and cite the memories it uses. Task: Draft a response that is grounded in the retrieved tweets and consistent with the persona profile.
export OPENAI_API_KEY="..." x-archive-rag draft "What do I think about OSS personal AI?" \ --db ./x-archive-rag.sqlite \ --call-openai \ --model gpt-4.1-mini
x-archive-rag draft "What do I think about local-first AI?" \ --db ./x-archive-rag.sqlite \ --call-openai \ --model local-model \ --base-url http://localhost:8000/v1
x-archive-rag mcp --db ./x-archive-rag.sqlite

- search_archive
- draft_from_archive
- get_persona_profile

x-archive-rag doctor --db ./x-archive-rag.sqlite

Export imported tweets for inspection or backup:

x-archive-rag export \ --db ./x-archive-rag.sqlite \ --format jsonl \ --output ./tweets.jsonl

See[docs/cli.mdfor the full CLI reference.

X archive ZIP or directory -> tweet normalization -> persistent SQLite memory + FTS5 + lightweight semantic vectors -> per-prompt retrieval with citation IDs -> persona profile -> grounded draft prompt, optional LLM call, or MCP tool response

Future releases can add external embedding providers, thread reconstruction, and local model providers without changing the core import/search model. The current release already includes CLI, MCP, export, and local web UI surfaces over the same SQLite memory layer.

Use this with your own archive or with explicit permission. The project is meant to help a person understand and draft from their own history. It should not be used to impersonate someone, automate posting as someone else, or hide AI-generated output as human-authored speech.

Generated drafts should cite the retrieved posts they used. Treat the output as a draft that needs human review.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.