Skip to main content

Local-first single-user knowledge engine — accumulates gathered knowledge and exposes it via MCP to connected agents like Claude Code.

Project description

Alexandria

Local-first single-user knowledge engine. Accumulates your gathered knowledge (raw sources, compiled wiki pages, event streams, AI conversations) and exposes it via MCP to connected agents like Claude Code for retroactive query, retrieval, and synthesis.

Alexandria is not a chat client. Interactive conversations happen in your existing MCP-capable agent (Claude Code, Cursor, Codex). Alexandria is the knowledge engine those agents connect to.

Install

pip install alexandria-wiki          # core
pip install "alexandria-wiki[pdf]"   # + PDF support
pip install "alexandria-wiki[all]"   # + PDF + YouTube transcripts

Or with uv:

uvx alexandria-wiki
# or
uv tool install alexandria-wiki

Quick Start

# 1. Initialize
alxia init

# 2. Connect to Claude Code (one-time setup)
alxia mcp install claude-code         # register MCP server
alxia hooks install claude-code       # auto-capture conversations

# 3. Restart Claude Code — Alexandria tools are now available

# 4. Ingest from anywhere
alxia ingest ~/Documents/paper.pdf
alxia ingest https://arxiv.org/abs/2407.09450
alxia ingest ./my-project                         # whole directory
alxia ingest epappas/alexandria                    # GitHub repo
alxia ingest ~/.claude/projects/*/session.jsonl    # conversation

# 5. Query your knowledge
alxia query "What do you know?"

Sources

Alexandria ingests from 14 source types:

Source Command
Local file alxia ingest ~/file.md
PDF alxia ingest ~/paper.pdf
URL (HTML) alxia ingest https://example.com/article
Code (.py/.ts/.rs/.go/.tf/.yml) alxia ingest main.py (AST extraction)
Directory alxia ingest ./my-project
Git repo alxia ingest https://github.com/owner/repo
GitHub shorthand alxia ingest owner/repo
Conversation alxia ingest ~/.claude/projects/*/session.jsonl
GitHub (events) alxia source add github --name repo --owner x --repo y
RSS/Atom alxia source add rss --name blog --feed-url https://example.com/feed
YouTube alxia source add youtube --name talks --urls "https://youtu.be/abc"
Notion alxia source add notion --name wiki --token-ref key --page-ids "abc"
HuggingFace alxia source add huggingface --name models --repos "meta-llama/Llama-3-8b"
Obsidian/Folder alxia source add folder --name vault --path ~/ObsidianVault
Zip/Tar alxia source add archive --name papers --path ~/papers.zip
IMAP alxia source add imap --name mail --imap-host imap.gmail.com --imap-user me
Clipboard alxia paste --title "note" --content "quick thought"

After adding sources, pull everything with:

alxia sync

MCP Integration

Alexandria exposes your knowledge to AI agents via the Model Context Protocol.

# Register with Claude Code (one-time)
alxia mcp install claude-code

# Install conversation capture hooks (one-time)
alxia hooks install claude-code

# Restart Claude Code — done. Verify:
alxia mcp status
alxia hooks verify claude-code

After setup, Claude Code has 20 Alexandria tools:

Category Tools
Navigate guide, overview, list, search, grep, read, follow
History history, why, timeline, events
Git git_log, git_show, git_blame
Sources sources, subscriptions
Write ingest, query, belief_add, belief_supersede

For other MCP clients:

alxia mcp serve-http --port 7219

CLI Reference

alxia init                    Initialize ~/.alexandria/
alxia status                  Operational dashboard
alxia doctor                  Health checks

alxia ingest <source>         Ingest file, dir, URL, repo, or conversation
alxia query <question>        LLM-powered answers from your knowledge base
alxia why <topic>             Belief explainability + provenance
alxia lint                    Find wiki rot (stale citations)
alxia synthesize              Generate temporal digest

alxia source add <type>       Add a source adapter
alxia source list             List configured sources
alxia sync                    Pull from all sources
alxia subscriptions poll      Poll RSS + IMAP
alxia subscriptions list      Show pending items

alxia workspace use <slug>    Switch workspace
alxia project create <name>   Create a project workspace

alxia secrets set <ref>       Store an encrypted secret
alxia beliefs cleanup         Dedup beliefs and remove orphans
alxia hooks install <client>  Install capture hooks
alxia capture conversation    Capture an agent session

alxia eval run                Run quality metrics (M1-M5)
alxia daemon start            Start background scheduler
alxia logs show               View structured logs

Architecture

  • SQLite + filesystem hybrid: filesystem is source of truth for documents, SQLite for search/metadata/events
  • Hybrid search: FTS5 BM25 + recency decay + belief support scoring (no vectors, no RAG — the agent IS the retriever)
  • AST extraction: Python, TypeScript, Rust, Go, Terraform, Ansible, YAML parsed into structured beliefs
  • Hostile verifier: every wiki write is verified before commit (citations, quote anchors, cascade policy)
  • Belief revision: structured claims with supersession chains and provenance
  • Conversation capture: auto-captures Claude Code sessions with artifact extraction (papers, repos)
  • Self-awareness: Alexandria can answer questions about its own state and capabilities
  • Document dedup: content-hash check skips re-ingest of unchanged files
  • Belief integrity: supersede-all-then-restore prevents duplicates; alxia beliefs cleanup removes orphans
  • AES-256-GCM vault: encrypted secrets with PBKDF2 key derivation
  • Structured JSONL logging with run_id correlation
  • 10 schema migrations applied automatically on init

See docs/architecture/ for the 20 architecture documents.

Docker

docker build -t alexandria .
docker run -v ~/.alexandria:/data alexandria init
docker run -v ~/.alexandria:/data alxia status

Development

git clone git@github.com:epappas/alexandria.git
cd alexandria
uv sync --dev
uv run pytest tests/       # 352+ tests
./scripts/build.sh          # test + build
./scripts/publish.sh        # test + build + PyPI + git tag

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alexandria_wiki-0.23.1.tar.gz (578.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alexandria_wiki-0.23.1-py3-none-any.whl (226.1 kB view details)

Uploaded Python 3

File details

Details for the file alexandria_wiki-0.23.1.tar.gz.

File metadata

  • Download URL: alexandria_wiki-0.23.1.tar.gz
  • Upload date:
  • Size: 578.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for alexandria_wiki-0.23.1.tar.gz
Algorithm Hash digest
SHA256 3196629d67f733739a52f3b5e98fdd915c0d4ff963180511fd478873533d36ab
MD5 e98a2b3dc45a342f631b9a3c560e1926
BLAKE2b-256 3f7741d2a43b6cd00cac5ee9a75f11242fccdb9f02e227b1614f4b5811ff984f

See more details on using hashes here.

File details

Details for the file alexandria_wiki-0.23.1-py3-none-any.whl.

File metadata

File hashes

Hashes for alexandria_wiki-0.23.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8c8e3adb26e6cbdceae9f48930c5bfe600cd4a437cb03c16dbbc2b3e0cb90ef
MD5 005f68d0801122bc257b93a9cac07768
BLAKE2b-256 d5e989fb7f9b0cd9e4c5064dd7ddb0bc966d05f0a571061e37de8144abbea953

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page