P2P Wiki AI — RAG chat and article generation for the P2P Foundation Wiki
Go to file
Jeff Emmett be5bf2169e Complete content split: mount p2pfoundation-wiki as read-only volume
- docker-compose: mount CONTENT_REPO_PATH (default ../p2pfoundation-wiki) at /app/content
- Set CONTENT_DIR=/app/content so articles_dir resolves to /app/content/wiki/
- Remove HOST_XMLDUMP_DIR (superseded by CONTENT_DIR)
- Remove tracked pagenames.txt, add to .gitignore
- Deleted ~7.7GB of duplicate local content (articles/, blog_static/, xmldump/)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 13:25:03 -04:00
.gitea/workflows refactor: split content from AI tooling, prepare for rename to p2pwiki-ai 2026-04-14 14:24:05 -04:00
backlog chore: add backlog-notify onStatusChange hook 2026-03-10 15:30:29 -07:00
drafts Add draft approval gadgets and wiki draft articles 2026-02-02 16:58:51 +00:00
src refactor: split content from AI tooling, prepare for rename to p2pwiki-ai 2026-04-14 14:24:05 -04:00
web feat: add rData (Umami) analytics to p2pwiki, p2pf blog and website 2026-03-10 14:06:08 -07:00
wiki_deploy Add CirrusSearch deployment script and backlog tasks 2026-02-21 14:41:32 -07:00
wiki_scripts Add MediaWiki client and gadget installation script 2026-02-05 12:57:53 +00:00
.dockerignore Add .dockerignore for optimized Docker builds 2026-02-21 17:48:54 -07:00
.env.example Complete content split: mount p2pfoundation-wiki as read-only volume 2026-04-16 13:25:03 -04:00
.gitignore Complete content split: mount p2pfoundation-wiki as read-only volume 2026-04-16 13:25:03 -04:00
Dockerfile Wire Infisical secret injection for ANTHROPIC_API_KEY 2026-02-24 09:32:37 -08:00
README.md refactor: split content from AI tooling, prepare for rename to p2pwiki-ai 2026-04-14 14:24:05 -04:00
docker-compose.yml Complete content split: mount p2pfoundation-wiki as read-only volume 2026-04-16 13:25:03 -04:00
entrypoint.sh Wire Infisical secret injection for ANTHROPIC_API_KEY 2026-02-24 09:32:37 -08:00
pyproject.toml Initial commit: P2P Wiki AI system 2026-01-23 13:53:29 +01:00

README.md

P2P Wiki AI

AI-augmented system for the P2P Foundation Wiki with two main features:

  1. Conversational Agent — Ask questions about 23,000+ wiki articles using RAG (Retrieval Augmented Generation)
  2. Article Ingress Pipeline — Drop article URLs to automatically analyze content, find matching wiki articles, and generate drafts

Content (wiki articles, XML dumps, infrastructure configs) lives in a separate repo: p2pfoundation-wiki

Quick Start

Prerequisites

  • Python 3.10+
  • Ollama installed locally (or access to a remote Ollama server)
  • Optional: Anthropic API key for Claude (higher quality article drafts)

Install & Run

pip install -e .

# Parse wiki content (from XML dumps or articles directory)
python -m src.parser

# Generate embeddings
python -m src.embeddings

# Start server
python -m src.api

Visit http://localhost:8420/ui for the web interface.

Content Directory

By default, the system looks for xmldump/ and articles/articles/ in the project root. To point at the separate content repo:

# In .env
CONTENT_DIR=/path/to/p2pfoundation-wiki

Or mount via Docker:

HOST_XMLDUMP_DIR=/opt/content/p2pfoundation-wiki/xmldump docker compose up -d

Docker Deployment

docker compose up -d --build
docker compose logs -f

Configuration

Copy .env.example to .env and configure:

Variable Default Description
CONTENT_DIR (unset) Path to content repo (resolves xmldump + articles)
HOST_XMLDUMP_DIR ./xmldump Host path for XML dump volume mount
OLLAMA_BASE_URL http://localhost:11434 Ollama server URL
OLLAMA_MODEL llama3.2 Model for chat Q&A
CLAUDE_MODEL claude-sonnet-4-20250514 Model for article drafts
USE_CLAUDE_FOR_DRAFTS true Route drafts to Claude
USE_OLLAMA_FOR_CHAT true Route chat to Ollama
ANTHROPIC_API_KEY (unset) Claude API key (or via Infisical)

API Endpoints

Endpoint Method Description
/chat POST Ask questions about wiki content
/ingress POST Process external article URL
/review GET List items in review queue
/review/action POST Approve/reject draft
/search GET Direct vector search
/articles GET List article titles
/health GET Health check

License

The AI system code is provided as-is for educational purposes. Wiki content is from the P2P Foundation under CC BY-SA 3.0.