obsidian-llm-wiki

repository·master·Indexed 18 days ago

https://github.com/kytmanov/obsidian-llm-wiki-local

A tool that transforms raw markdown notes into a structured, interlinked wiki using local or cloud-based LLMs. It automates concept extraction and article creation, allowing users to treat notes as source material for a self-improving knowledge base in Obsidian. Version 0.8.5 supports providers such as Ollama, LM Studio, vLLM, Groq, and Together AI.

Tokens
20.2K
Snippets
68
Records
97
Agent score
73%

What's inside obsidian-llm-wiki

  1. How the `olw` pipeline works

    master

    The pipeline transforms raw notes into a structured wiki through three distinct stages:

    1. Ingest (olw ingest or olw run): Uses a Fast LLM (3B–8B) to read notes, extract concept names, preserve named references as 'knowledge item candidates', and write quality scores/summaries to state.db. It creates source summary pages in wiki/sources/.
    2. Compile (olw compile): Uses a Heavy LLM (7B–14B) to gather all source notes for a concept, inject previous rejection feedback, and write a wiki article with [[wikilinks]]. Articles are placed in wiki/.drafts/ for review.
    3. Review (olw review or olw approve): An interactive menu to approve, reject, diff, or edit drafts. Approved articles are published to wiki/, annotations are stripped, wiki/index.md is updated, and changes are Git committed.
  2. Understand draft annotations

    master

    Drafts with low confidence or sparse sources include HTML comments that are visible in the Obsidian editor but hidden in preview mode. These serve as warnings for the human reviewer.

    Examples:

    • <!-- olw-auto: low-confidence (0.32) — verify before publishing -->
    • <!-- olw-auto: single-source — cross-reference recommended -->

    These annotations are automatically stripped when a draft is approved via olw review.

  3. Understand the vault structure

    master

    The olw project organizes your vault into specific directories. Crucially, the raw/ directory is immutable and is never modified by olw.

    • raw/: Your original notes.
    • wiki/: The generated knowledge base.
      • wiki/sources/: Auto-generated source summary pages.
      • wiki/.drafts/: Pending articles awaiting human review.
      • wiki/index.md: The auto-generated navigation and routing layer.
      • wiki/queries/: Saved Q&A answers.
      • wiki/synthesis/: Saved synthesis articles.
    • wiki.toml: Global configuration.
    • vault-schema.md: LLM context defining vault conventions.
    • .olw/: Internal state.
      • state.db: SQLite database containing all metadata, concepts, and rejections.
      • compare/: Comparison reports and artifacts.
      • pipeline.lock: Advisory lock file.
  4. Run smoke tests for inline source citations

    master

    To validate how different models (especially smaller local models) handle citation markers, you can run the provided smoke test scripts. You must set the INLINE_SOURCE_CITATIONS=1 environment variable to enable the feature during the test run.

    Use the following commands to run standard smoke tests and comparison tests using LM Studio as a provider:

    # Run standard smoke test
    PROVIDER=lm_studio FAST_MODEL=gemma4:e4b HEAVY_MODEL=gemma4:e4b INLINE_SOURCE_CITATIONS=1 bash scripts/smoke_test.sh
    
    # Run comparison smoke test
    PROVIDER=lm_studio FAST_MODEL=gemma4:e4b HEAVY_MODEL=gemma4:e4b INLINE_SOURCE_CITATIONS=1 bash scripts/compare_smoke.sh
  5. Configure Obsidian Web Clipper (Official) for raw/ ingestion

    master

    To automate the ingestion of web articles, configure the official Obsidian Web Clipper to save files directly into your vault's raw/ folder. This allows olw to process the content automatically.

    1. Install the Obsidian Web Clipper.
    2. In the extension settings, navigate to Template.
    3. Set the Save location to raw/ within your vault.
    4. Apply the following template to ensure metadata is correctly captured for the pipeline:
    ---
    source_url: {{url}}
    source_title: {{title}}
    captured: {{date}}
    ---
    
    # {{title}}
    
    {{content}}

    Once clipped, you can manually run olw ingest raw/{{filename}}.md or use olw watch to automate the process.

  6. Tune context windows for performance

    master

    Context window settings in wiki.toml impact how much data the models process and the resulting article quality. Adjust these based on your available VRAM.

    heavy_ctx (Article Generation)

    Controls how much source material the heavy model reads. The source budget is approximately heavy_ctx / 2 characters.

    • 8 GB VRAM: 8192 (Short articles)
    • 16 GB VRAM: 32768 (Default)
    • 32 GB+ VRAM: 65536 (Rich multi-source articles)

    fast_ctx (Ingest Analysis)

    Controls ingest analysis. Notes longer than fast_ctx / 2 characters are automatically split into chunks and analyzed sequentially.

    • 8 GB VRAM: 8192 (~4K chars)
    • 16 GB VRAM: 16384 (~8K chars - Default)
    • 32 GB+ VRAM: 32768 (~16K chars)

    After editing wiki.toml, run olw compile --force to regenerate articles with the new budget.

  7. Run the obsidian-llm-wiki pipeline

    master

    The pipeline processes raw notes into wiki articles. You can run the entire process at once or step-by-step.

    Full pipeline: Runs ingest, compile, lint, and optional auto-approval.

    olw run

    Step-by-step:

    1. Ingest: Read new files from raw/.
      olw ingest --all
    2. Compile: Extract concepts and create/update wiki articles.
      olw compile
    3. Review: Interactively review generated drafts.
      olw review

    Note: If you haven't set a default vault in olw setup, use the --vault flag or set the OLW_VAULT environment variable.

    olw run
  8. Speed up long-note ingest with parallel processing

    master

    For vaults with many long notes (>8K chars), you can enable parallel chunk analysis to reduce wall time.

    1. In wiki.toml, set ingest_parallel = true under [pipeline].
    2. Before starting Ollama, set the OLLAMA_NUM_PARALLEL environment variable in your shell.

    Example for 16 GB VRAM:

    OLLAMA_NUM_PARALLEL=4 ollama serve

    In wiki.toml:

    [pipeline]
    ingest_parallel = true
  9. Review and approve generated drafts

    master

    When you run olw compile, generated articles are initially placed in the wiki/.drafts/ directory. Because Obsidian hides dotfolders by default, these articles will not appear in your graph immediately. To make them visible in the wiki/ folder, you must review or approve them.

    Use olw review for an interactive review process, or olw approve --all to move all drafts to the main wiki directory automatically.

    olw review        # interactive review
    # or
    olw approve --all