- Introduction
- Key Features
- System Requirements
- Environment Setup Guide
- Configuration
- Usage Guide
- RAG Capabilities
- Architecture & Deep Dive
- Testing
- Benchmarking
This tool is designed to externalize your Perplexity.ai conversation history into organized, semantically searchable Markdown files. It facilitates the emergence of a personal knowledge base powered by local AI, bridging the gap between ephemeral inquiry and structured knowledge.
- Parallelized Extraction: Leverages Playwright to extract multiple conversation threads simultaneously for high-velocity data retrieval.
- Architectural Resilience: Automatically restores browser contexts and retries operations, ensuring continuity amidst environmental instability.
- Advanced RAG (Retrieval-Augmented Generation): Engage in a cognitive dialogue with your history. The system employs intent analysis to synthesize broad summaries or pinpoint specific technical insights.
- HyDE (Hypothetical Document Embeddings): An optional retrieval enhancement that generates a hypothetical answer to improve semantic matching. Highly configurable (off, fusion, or supplement modes) via environment variables to balance precision and recall.
- Cross-Encoder Reranking: After initial retrieval, a local ONNX cross-encoder (
ms-marco-MiniLM-L-6-v2) rescores the top candidates by jointly reasoning over query and passage, surfacing the most relevant results before synthesis. - Semantic Vector Search: Move beyond keyword matching. Locate information based on conceptual depth and semantic relevance.
- Persistent State Tracking: Frequent checkpoints allow the system to resume progress after any interruption.
- Interactive Synthesis (REPL): A streamlined command-line interface for human-system synergy.
- Smart Content Hashing: The scraper now computes a SHA-256 hash of thread content. Subsequent runs will skip unchanged threads, significantly reducing execution time and API overhead while ensuring your local history stays up to date when new messages are added.
- Operating System: Developed and tested on Windows. Linux and macOS are currently untested.
- Shell: PowerShell 7.6 is highly recommended for running this project.
- WSL (Windows Subsystem for Linux): Must be pre-installed. The system utilizes
bash -cfor certain internal operations and setup commands. - Ripgrep: Platform-specific
rgbinaries are bundled. However, if you encounter issues where search results do not appear, please try installing ripgrep manually on your system as a troubleshooting step.
If you are new to development or don't have the necessary tools installed, follow these steps to set up your environment.
We recommend using a version manager to install Node.js. This allows you to easily switch versions and avoids permission issues.
- Windows:
- Download and run the latest installer from nvm-windows.
- Open a new PowerShell (v7.6 recommended) and run:
nvm install 20 nvm use 20
- macOS / Linux:
- Install
nvmby following the instructions at nvm.sh. - Run:
nvm install 20 nvm use 20
- Install
An AI provider is optional. It is only required if you want to use the Semantic Search or RAG (Retrieval-Augmented Generation) features. Basic extraction and keyword search work without it. You can use local Ollama or any OpenAI-compatible API (OpenAI, OpenRouter, DeepSeek, etc.).
-
Ollama (Local):
- Download and install from ollama.ai.
- Pull required models:
ollama pull nomic-embed-text ollama pull deepseek-r1
-
External API (OpenAI-compatible):
- Obtain an API key from your provider (e.g., OpenRouter, OpenAI).
- Configure
AI_PROVIDER,AI_API_KEY, andAI_BASE_URLin your.envfile.
If you don't have the git command installed, you can simply download this project as a ZIP file from GitHub and extract it.
Once extracted, open your terminal in the project folder and run:
pnpm install
pnpm exec playwright install chromiumEstablish your environment by duplicating the template:
bash -c "cp .env.example .env"- HEADLESS: Set to
falsein your.envfile. Note: Headless mode (true) is currently non-functional due to Cloudflare Turnstile protection on Perplexity.ai. Using headful mode allows you to complete any challenges manually if they appear. - AI_PROVIDER: "ollama" or "openai-compatible".
- AI_API_KEY: Required for external providers.
- AI_BASE_URL: Base URL for external providers (e.g., https://openrouter.ai/api/v1).
- AI_MODEL: Cognitive model for RAG synthesis (e.g., deepseek-r1). The system defaults to
llama3.1internally if this is not specified. - AI_EMBED_MODEL: Model for generating vector representations (e.g., nomic-embed-text).
- EXPORT_STRATEGIES: A comma-separated list of enabled export formats (default:
markdown). - ENABLE_VECTOR_SEARCH: Set to
trueto activate semantic and RAG layers.
Launch the system:
# Start the development environment
pnpm run dev- Start scraper (Library): Initiates extraction. Authenticate manually if required.
- Note: Due to the complexity of Perplexity's API and potential network fluctuations, it may be necessary to run the scraper multiple times to ensure all conversations are fully gathered. The system uses checkpoints to resume where it left off.
- Search conversations: Interface with your history using various modes:
- Auto: Heuristic selection between semantic and exact search.
- Semantic: Fuzzy matching via high-dimensional vector space.
- RAG: Direct inquiry, such as "What did I learn about emergent intelligence?"
- Exact: Rapid string matching via ripgrep (bundled).
- Chat with history: Engage in a continuous, multi-turn dialogue with your knowledge base. The assistant maintains context and cites sources from your history.
- Build vector index: Processes Markdown exports into a local vector store.
- Reset all data: Purges checkpoints, authentication data, and the vector index.
The RAG modality is engineered for various levels of cognitive inquiry:
- Broad Synthesis: "Summarize all threads regarding distributed systems."
- Granular Retrieval: "Locate the specific TypeScript pattern I used for the worker pool."
- Cross-Thread Integration: "How has my conceptual understanding of React hooks shifted?"
The pipeline runs enhancement stages automatically:
- HyDE: Depending on the
HYDE_MODE(default:supplement), the system may generate a hypothetical answer passage to bridge the lexical gap between questions and historical content. Insupplementmode, it only activates if initial semantic searches yield weak results. - Expanded pool: Precise mode retrieves 50 candidates (up from 35), exhaustive mode retrieves 80.
- Cross-encoder reranking: A local ONNX model (
Xenova/ms-marco-MiniLM-L-6-v2) jointly scores each (query, passage) pair and reorders before synthesis. Includes a permissive threshold (-5.0) with top-20 fallback to guarantee candidates. Activates automatically afterpnpm install. First run downloads ~85MB model, cached thereafter. - Granular fact extraction: MapReduce extracts atomic facts with source-level deduplication, loose-relevance filtering, and robust JSON parsing (per-entry error handling).
- Cited synthesis: Final answer cites sources by title (e.g.,
[which big python projects use pdm...]) andHistory Sources Exploredshows each fact with a preview.
For a detailed look at our RAG implementation, hybrid search strategy, and theoretical foundations, please refer to:
π ARCH.md
- src/ai/: AI interaction and advanced RAG orchestration layers.
- src/scraper/: Playwright-based extraction logic and parallel worker pool management.
- src/search/: Vector storage (Vectra) and ripgrep search implementation.
- src/repl/: Interactive CLI components.
- src/utils/: Shared utility functions for data chunking, logging, and API diagnostics.
π DEBUGGING.md
We prioritize a "Testing Trophy" architecture, emphasizing integration tests.
# Execute unit-level verifications
pnpm run test:unit
# Execute integration-level verifications
pnpm run test:integrationMeasure RAG pipeline latency and validate the full retrieval stack against your actual export data.
pnpm run benchmarkRequires a built vector index and a running AI provider instance. The benchmark runs a set of predefined queries end-to-end through the full pipeline (HyDE β hybrid search β cross-encoder reranking β MapReduce β synthesis) and reports per-query latency and success rate. Edit BENCHMARK_QUERIES in src/benchmark.ts to tailor queries to your history.
π BENCHMARKS.md: Full details on each benchmark, why the metrics were chosen, how to interpret results, and how to write effective custom queries.