### Install Obsidian LLM Wiki from Website Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md Alternative installation method using the community plugin website. ```markdown visit [community.obsidian.md/plugins/karpathywiki](https://community.obsidian.md/plugins/karpathywiki) and click **Add to Obsidian** to install directly. ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CONTRIBUTING.md Clone the repository and install project dependencies using pnpm. ```bash git clone https://github.com/green-dalii/obsidian-llm-wiki.git cd obsidian-llm-wiki pnpm install ``` -------------------------------- ### Manual Installation of Obsidian LLM Wiki Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md Steps for manually installing the plugin by downloading files. ```markdown 1. Download `main.js`, `manifest.json`, `styles.css` from [Releases](https://github.com/green-dalii/obsidian-llm-wiki/releases) 2. In Obsidian, go to Settings → Community plugins. On the **Installed plugins** tab, click the folder icon to open your plugins directory 3. Create a folder named `karpathywiki`, drop the three files inside 4. Back in Obsidian, click the refresh icon — **Karpathy LLM Wiki** will appear under Installed plugins 5. Toggle it on to enable ``` -------------------------------- ### Development Setup for Obsidian LLM Wiki Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md Commands for cloning the repository and setting up the development environment. ```bash git clone pnpm install pnpm build ``` -------------------------------- ### Install Obsidian LLM Wiki Plugin Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md Instructions for installing the plugin via Obsidian's community plugin market. ```markdown 1. In Obsidian, go to **Settings → Community plugins** 2. Click **Browse** and search for "Karpathy LLM Wiki" 3. Click **Install**, then **Enable** ``` -------------------------------- ### Example Input Markdown Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md This is an example of the input markdown file used to generate wiki pages. It contains a main heading and a list of sub-topics. ```markdown ### Machine Learning Machine learning uses algorithms to learn from data. ### Types - Supervised learning - Unsupervised learning - Reinforcement learning ``` -------------------------------- ### Example Output Concept Page Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md This is an example of a generated wiki concept page. It includes frontmatter with metadata, basic information, a description, related concepts and entities, and mentions from the source document. ```markdown --- type: concept created: 2025-12-01 updated: 2026-05-15 sources: ["[[sources/machine-learning]]"] tags: [method] aliases: ["监督学习", "Supervised Learning"] --- ### Supervised Learning ### Basic Information - Type: method - Source: [[sources/machine-learning]] ### Description Supervised learning is a machine learning paradigm where models learn from labeled training data to make predictions on unseen data... ### Related Concepts - [[concepts/Machine-Learning|Machine Learning]] - [[concepts/Unsupervised-Learning|Unsupervised Learning]] ### Related Entities - [[entities/Arthur-Samuel|Arthur Samuel]] ### Mentions in Source - "Supervised learning uses labeled data to train predictive models..." ``` -------------------------------- ### Stubbing activeDocument in Test Environment Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md When jsdom lacks 'activeDocument', stub it in the test setup file. Production code should then use 'activeDocument' directly without fallbacks or eslint-disable comments. ```typescript // eslint-disable-next-line obsidianmd/no-global-this (globalThis as Record).activeDocument = globalThis.document; ``` -------------------------------- ### Build Project Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CONTRIBUTING.md Build the project for development (watch mode) or production. ```bash # Development build (watch mode) pnpm dev # Production build pnpm build ``` -------------------------------- ### Run Unit Tests Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CONTRIBUTING.md Run unit tests for the project, either a single run or in watch mode. ```bash pnpm test # single run pnpm test:watch # watch mode ``` -------------------------------- ### Run Quality Checks Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CONTRIBUTING.md Execute all required quality checks: linting, unit tests, TypeScript type checking, and production build. ```bash pnpm lint # ESLint with Obsidian plugin rules (0 errors, 0 warnings) pnpm test # Vitest unit tests (all pass) npx tsc --noEmit # TypeScript type check (0 errors, 0 warnings) — Dual Gate pnpm build # esbuild production build (must exit cleanly) ``` -------------------------------- ### Automated Gates (Lint, Type Check, Test, Build) Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md These commands must all pass sequentially. They cover linting, TypeScript type checking, testing, and building the project. ```bash pnpm lint # ESLint + Obsidian rules: 0 errors, 0 warnings npx tsc --noEmit # TypeScript: 0 errors (ESLint does NOT check type safety) pnpm test # Vitest: all pass, 0 failures pnpm build # esbuild: clean exit ``` -------------------------------- ### Tagging and Pushing a Release Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md After a PR is merged to main, create and push a tag for the release. Ensure you are on the latest main branch and do not use a 'v' prefix for the tag. ```bash # Tag (after PR merge, NO 'v' prefix) git tag -a X.Y.Z -m "X.Y.Z" git push origin X.Y.Z ``` -------------------------------- ### Watch Mode Command Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md Use 'pnpm dev' to enable watch mode, which rebuilds on file changes and stays running. It is similar to 'build:dev' but remains active. ```bash pnpm dev ``` -------------------------------- ### Production Build Commands Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md Use 'pnpm build' for production builds, which disables console.debug and removes sourcemaps. This is the recommended command for release. ```bash pnpm build ``` -------------------------------- ### Project Structure Overview Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md This snippet displays the directory structure of the Obsidian LLM Wiki project. It shows the organization of source files, types, utilities, LLM clients, wiki engine modules, schema, UI components, and tests. ```tree src/ ├── main.ts # Plugin entry point ├── types.ts # Shared types + EngineContext ├── utils.ts # Utilities (slugify, parseJson, etc.) ├── texts.ts # i18n texts (barrel, 8 languages) ├── llm-client.ts # LLM clients ├── wiki/ # Wiki engine │ ├── wiki-engine.ts # Orchestrator │ ├── query-engine.ts # Conversational query │ ├── source-analyzer.ts # Iterative batch extraction │ ├── page-factory.ts # Entity/concept CRUD + merge │ ├── conversation-ingest.ts # Chat → wiki knowledge │ ├── lint-fixes.ts # Fix logic │ ├── lint-controller.ts # Lint orchestration │ ├── lint/ # Lint sub-modules │ ├── contradictions.ts # Contradiction detection │ ├── system-prompts.ts # Language directive + labels │ └── prompts/ # LLM prompt templates ├── schema/ # Schema co-evolution ├── ui/ │ ├── settings.ts # Settings panel │ └── modals.ts # Lint/Ingest/Query modals └── __tests__/ # Unit tests (vitest, 121 tests) ``` -------------------------------- ### Pre-Release Checklist - Gate 1 Verification Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md Commands to verify the first gate of the pre-release checklist, ensuring linting, TypeScript compilation, tests, and build processes complete without errors. ```bash pnpm lint # Gate 1: ESLint - 0 errors, 0 warnings npx tsc --noEmit # Gate 1: TypeScript - 0 errors, 0 warnings pnpm test # Gate 1: Tests - all pass, 0 failures pnpm build # Gate 1: Build - clean exit ``` -------------------------------- ### Ensuring Release Build Integrity Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md When generating a local debug build for testing, verify the 'main.js' file. It should include an inline sourcemap and 'console.debug' should not be replaced. ```bash 1. Run `pnpm build:dev` to generate `main.js` (2MB+ with inline sourcemap) 2. Verify `main.js` ends with `//# sourceMappingURL=data:application/json;base64,... 3. Confirm `console.debug` is NOT replaced (header should not contain `console.debug = function(){};`) 4. The 3 output files are: `main.js`, `manifest.json`, `styles.css` 5. Offer to zip them or tell the user the paths ``` -------------------------------- ### Debug Build Commands Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md Use 'pnpm build:dev' for debug builds, which preserves console.debug and includes inline sourcemaps. This is used when a local test build is requested. ```bash pnpm build:dev ``` -------------------------------- ### Enable Automatic Updates for Obsidian LLM Wiki Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md How to configure Obsidian to automatically check for plugin updates. ```markdown 1. Go to **Settings → Community plugins** 2. Toggle on **Automatically check for plugins updates** ``` -------------------------------- ### Mermaid Architecture Diagram Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CONTRIBUTING.md Visual representation of the Obsidian LLM Wiki's architecture, showing the flow of data and interactions between different components. ```mermaid graph TD User -->|Cmd+P| main.ts main.ts -->|ingest| WikiEngine main.ts -->|query| QueryEngine main.ts -->|lint| lint-controller WikiEngine -->|analyze| SourceAnalyzer WikiEngine -->|CRUD + merge| PageFactory WikiEngine -->|write| Vault QueryEngine -->|local match| localKeywordMatch["localKeywordMatch (Layer 1)"] QueryEngine -->|LLM select| selectRelevantPagesWithLLM["selectRelevantPagesWithLLM (Layer 3)"] QueryEngine -->|read| Vault lint-controller -->|dead links| scanDeadLinks lint-controller -->|orphans| scanOrphans lint-controller -->|duplicates| generateDuplicateCandidates lint-controller -->|scans| scanners["scanners.ts (scanners.ts)"] lint-controller -->|fixes| fix-runners["fix-runners.ts"] SourceAnalyzer -->|iterative batch| LLMClient PageFactory -->|page generation| LLMClient QueryEngine -->|selection + answer| LLMClient ``` -------------------------------- ### Obsidian LLM Wiki Directory Structure Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md This outlines the core directory structure for the obsidian-llm-wiki plugin, separating source documents, generated wiki pages, and schema configuration. ```tree sources/ # 📄 Your source documents (read-only) ↓ ingest wiki/ # 🧠 LLM-generated Wiki pages ↓ query / maintain schema/ # 📋 Wiki structure configuration (naming, templates, categories) ``` -------------------------------- ### TDD Development Loop Steps Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md The mandatory development loop for every code change, including deep thinking, planning, writing tests, implementation, and verification. ```markdown 1. Deep thinking → What is the problem? Edge cases? Failure modes? 2. Plan → Files to change, function signatures, side effects 3. Write test → Failing test that defines expected behavior 4. Confirm RED → Run test, verify it fails for the right reason 5. Implement → Minimum code to make the test pass 6. Confirm GREEN → Run test, verify it passes 7. Refactor → Clean up; tests must still pass 8. 4-Gate verify → lint + tsc + test + build all clean 9. Six-Gate review → side effects + breaking + performance + doc + release ``` -------------------------------- ### Six-Gate Quality Closure Process Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md This table outlines the six quality gates that every change must pass before being considered complete. It details the constraint, how it's checked, and who is responsible for each gate. ```markdown | Gate | Constraint | How | Who | |------|-----------|-----|-----| | **1. Code correct** | `pnpm lint` 0/0 + `npx tsc --noEmit` 0/0 + `pnpm test` all pass + `pnpm build` clean | 4-Gate script | Developer | | **2. No side effects** | Call-site audit + data flow trace + state mutation check + error propagation check | Structured review | Developer | | **3. No breaking changes** | API/Schema/File format/Default behavior/Command IDs/Obsidian API all backward-compatible | Breaking-change matrix | Developer | | **4. No performance regression** | CPU/memory/IO/network/token usage — 5-dim walkthrough, written assessment table | simplify + code-review + Gate 4 table | Developer | | **5. Docs complete** | 8 READMEs + ROADMAP + CLAUDE.md + CHANGELOG + memory all updated | pre-release-gate | Gate | | **6. Release clean (superset of 1-5)** | Gate 1-5 all green, PLUS TOC anchors + localization + Release Notes + Contributors + git hygiene + **Gate 4 perf re-verification** | pre-release-gate | Gate | ``` -------------------------------- ### Update Obsidian LLM Wiki Plugin Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md Instructions for updating the plugin through Obsidian's community plugin settings. ```markdown 1. Go to **Settings → Community plugins** 2. Click **Check for updates** 3. Find **Karpathy LLM Wiki** in the list and click **Update** ``` -------------------------------- ### Obsidian LLM Wiki Codebase Structure Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md Details the internal codebase structure of the obsidian-llm-wiki plugin, including modules for the wiki engine, schema management, and user interface. ```tree wiki/ # Wiki engine modules wiki-engine.ts # 🎯 Orchestrator query-engine.ts # 💬 Conversational query source-analyzer.ts # 📊 Iterative batch extraction page-factory.ts # 🏗️ Entity/concept CRUD + merge lint-controller.ts # 🔍 Lint orchestration lint-fixes.ts # 🛠️ Fix logic for dead links, empty pages, orphans lint/ # Lint sub-modules duplicate-detection.ts # 🔄 Programmatic candidate generation fix-runners.ts # ⚡ Batch fix execution helpers scanners.ts # 🔍 Scanners (dead links, orphans, aliases) contradictions.ts # ⚠️ Contradiction detection system-prompts.ts # 🗣️ Language directive + section labels schema/ # Schema co-evolution schema-manager.ts # 📋 Schema CRUD + suggestions auto-maintain.ts # 🔄 File watcher + periodic lint ui/ # User interface settings.ts # ⚙️ Settings panel modals.ts # 📦 Lint/Ingest/Query modals + shared modules: llm-client.ts, prompts.ts, texts.ts, utils.ts, types.ts ``` -------------------------------- ### Push Workflow for Protected Main Branch Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/CLAUDE.md This sequence outlines the process for pushing changes when the main branch is protected. It involves creating a feature branch, pushing it, creating a pull request, merging via 'gh pr merge', and then pulling the updated main branch. ```bash # Push workflow (main is protected) git checkout -b chore/vX.Y.Z-release git push origin chore/vX.Y.Z-release gh pr create --title "chore: bump version to X.Y.Z" --body "## Summary\n...\n\n## Test plan\n- [x] ..." --base main gh pr merge --merge --delete-branch git checkout main && git pull origin main ``` -------------------------------- ### Obsidian LLM Wiki Generated Page Types Source: https://github.com/green-dalii/obsidian-llm-wiki/blob/main/README.md Lists the types of Markdown files generated by the obsidian-llm-wiki plugin, including source summaries, entity pages, concept pages, index, and logs. ```tree wiki/sources/filename.md — 📄 Source summary wiki/entities/entity-name.md — 👤 Entity pages (people, orgs, projects, etc.) wiki/concepts/concept-name.md — 💡 Concept pages (theories, methods, terms, etc.) wiki/index.md — 📑 Auto-generated index wiki/log.md — 📝 Operation log ```