Skip to content

Repository files navigation

Knowledge Brain

An Obsidian plugin that turns your markdown notes into a connected knowledge graph — a directed acyclic graph (DAG) of thoughts — with a built-in streaming AI chat (DeepSeek / OpenAI / Gemini / Claude) that can suggest tags, statuses, links, follow-up questions, and even turn chat answers into new notes.

The chat is grounded in your graph: it finds the notes most relevant to your question, cites them inline, and can highlight the path your answer took through your knowledge graph — a capability no other Obsidian AI plugin has.

Any markdown note in your vault is already a thought. The plugin reads standard YAML frontmatter, so your knowledge base stays plain, portable markdown.

Author: Kerekes Stefan · Version: 0.4.3 · Desktop only


Features


Knowledge_brain
Screenshot 2026-08-10 181644
Screenshot 2026-08-10 180943
Screenshot 2026-08-10 181001
Screenshot 2026-08-10 181026
Screenshot 2026-08-10 181038
Screenshot 2026-08-10 181049
Screenshot 2026-08-11 194810
Screenshot 2026-08-11 194821
Screenshot 2026-08-10 181137
Screenshot 2026-08-10 181157

🧭 Ask the graph — chat grounded in your knowledge

What makes Knowledge Brain different: instead of answering from general knowledge, the chat pulls in your actual notes for every question and can show you the reasoning path through them.

  • Every message auto-retrieves the most relevant thoughts for your question (local BM25 — private, no embeddings, no extra API cost) and hands them to the model as numbered context.
  • The model cites your notes inline as [n] — answers point at real thoughts, not hallucinated sources.
  • Each answer gets a "Used thoughts" row: clickable chips that open the cited notes, plus a Show in graph action.
  • Show in graph opens the graph view with the traversal path between the cited thoughts highlighted — you can see exactly which chain of ideas your answer drew on.
  • Retrieval is a setting, on by default (Settings → Chat context retrieval); tune how many candidate thoughts the model sees (Retrieved thoughts per message).

🧠 Thoughts as plain markdown

  • Every markdown note is a thought, indexed live from your vault (create, edit, rename, delete — the index follows automatically).
  • Thoughts link to each other through a parents list in frontmatter, forming a directed acyclic graph — the plugin validates links and refuses cycles, self-links, and duplicates.
  • Optional frontmatter metadata: tags, status (idea / in progress / done), questiontype (scientific, practical, comparative, historical, causal, critical), source, edge parentlabels.
  • Renaming a note automatically rewrites every parent reference that points at it.

🕸️ Interactive graph view

  • Cytoscape.js-powered graph with Breadth-first, Concentric, or CoSE layouts, node size mapped to link degree, and arrows on edges.
  • Color-coded by status (idea / in progress / done) with an auto-generated legend.
  • Filter by status or tag, adjust node spacing with a slider (persisted in settings).
  • Neighborhood view: show only the notes within 1–3 hops of a thought, centered on the active note (or a thought you pick).
  • Path highlighting: pick two thoughts and the shortest connecting path is highlighted, with the rest dimmed.
  • Knowledge growth timeline: replay the growth of your knowledge — play animates nodes/edges appearing in created_at order, with a scrubber, a live date label, and speed control. Composes with the status/tag/neighborhood filters.
  • Hover a node for a preview tooltip (title, status, type, tags, content); click to open the note.
  • Right-click a node for AI tag suggestions, AI status suggestions, or delete.
  • Statistics modal: totals, links, breakdown by thought type and follow-up groups.
  • Check similarity: finds near-duplicate thoughts locally (token-cosine over title + content — no API calls).

💬 Streaming AI chat

  • Bring your own key for DeepSeek, OpenAI (ChatGPT), Google Gemini, or Anthropic Claude — pick a model from the list or type any custom model id.
  • Streaming responses with visible reasoning/thinking output for models that support it (DeepSeek thinking, OpenAI reasoning effort, Gemini thinking, Claude extended thinking).
  • Context thought: pin the active note (or a graph node) as chat context.
  • After each answer, get follow-up suggestions and save the answer as a new thought — the AI suggests the best existing parent(s) to file it under, or lets you create a new root.
  • Everything is copyable: individual messages, suggestions, the whole conversation.

❓ Automatic follow-up questions

  • Opening a note in the sidebar generates follow-up questions grouped by type (scientific, practical, comparative, historical, causal, critical) to deepen your thinking.
  • Choose which groups to generate and how many questions per group; pause/resume automatic generation; regenerate on demand.
  • Questions already answered elsewhere in the graph are marked as answered in ….
  • Click a follow-up to load it straight into the chat with the right context set.

🗂️ Sidebar panes

  • Backlinks — thoughts that link to the active note (with edge labels).
  • Siblings — thoughts that share a parent with the active note.
  • Follow-ups — generated questions for the active note.
  • Orphan radar — thoughts with no parent (roots that nothing links up to), with one-click AI Suggest link that proposes a specific-to-general chain of parents (e.g. CatsCat-like carnivoresCarnivoresMammalsAnimals). It never suggests the thought's own topic as a parent, and Latin taxonomic ranks come with their English name, e.g. Felidae (cats). Link as hierarchy files the orphan under the most specific parent and chains each level under the next, creating the missing parent notes; every suggestion is copyable. Also surfaces the active note's unanswered follow-up questions.
  • Optionally combine the backlinks/siblings/follow-ups panes into a single sidebar tab (setting), or keep them as separate panes. The orphan radar stays its own pane.

🔍 Local search & retrieval

  • BM25 full-text search over all thoughts (memoized index, rebuilt on change) with English and Romanian stopword handling.
  • Powers the search modal, AI operation context, and the chat's automatic thought retrieval — cheap and private, no embeddings API needed.

🤖 AI-assisted organization

  • Suggest tags and suggest status for a thought (toggleable in settings).
  • Suggest parents when saving a new thought — ranked best-first with reasons.
  • Suggest titles — 3–5 short, specific noun-phrase titles extracted from the content.

Commands

Command What it does
Open knowledge brain graph Opens the graph view
Open knowledge brain chat Opens the chat view
Open knowledge brain follow-up questions / backlinks / siblings Opens the sidebar panes
Open knowledge brain orphan radar Opens the orphan radar pane (orphans + unanswered follow-ups)
Set chat context to current note Pins the active note as chat context
Create new thought Modal to create a titled thought with parents, tags, status
Search knowledge brain thoughts BM25 search modal
Knowledge Brain: set status / tags of active thought Edit metadata of the active note
Knowledge Brain: generate tags / status for active thought (AI) AI suggestions for the active note
Knowledge Brain: reload index Full vault rescan

There's also a ribbon icon and status bar items (KB Graph, KB Chat) for quick access.

Frontmatter format

A thought is just a markdown file. The plugin manages these frontmatter keys (anything else is preserved untouched):

---
parents:
  - Some Parent Thought
parent_labels:
  Some Parent Thought: contradicts
tags:
  - knowledge-management
  - ai
status: idea
question_type: causal
source: https://example.com/article
created_at: 2026-08-01T12:00:00.000Z
updated_at: 2026-08-09T18:30:00.000Z
---

The body of the note is the thought's content — free-form markdown.

Installation

Manual

  1. Download main.js, manifest.json, and styles.css from the latest release.
  2. Create a folder <your-vault>/.obsidian/plugins/knowledge-brain/ and copy the three files into it.
  3. Restart Obsidian, then enable Knowledge Brain in Settings → Community plugins.

BRAT (beta testing)

  1. Install the BRAT plugin.
  2. Add this repository: Stef4678/knowledge-brain.

Setup

  1. Open Settings → Knowledge Brain.
  2. Pick a provider (DeepSeek, OpenAI, Gemini, or Claude) and paste your API key.
  3. Choose a model (sensible defaults per provider, custom ids allowed) and tune temperature / thinking mode.
  4. Click Test connection to verify the key.
  5. (Optional) Set a default folder for new thoughts — the graph, similarity check, and sidebar panes focus on this folder.

The graph, search, similarity, and all note management work without an API key. Only chat and AI-assisted suggestions need one.

Settings reference

Setting Default Notes
Provider DeepSeek DeepSeek / OpenAI / Gemini / Claude
API key Required for chat & AI ops
Model provider default Dropdown of known models or custom id
Temperature 1.0 0–2 (0–1 for Claude)
Thinking mode on Only for models that support reasoning
Default folder vault root Where new thoughts are created
Graph node spacing 3.0 0.6 (dense) – 6 (spread out)
Tag word separator - machine-learning vs machine_learning
AI tag / status suggestions on Hides the corresponding menu items when off
Combined sidebar pane off One tab vs. three separate tabs
Chat context retrieval on Grounds chat answers in related thoughts (cited inline as [n])
Retrieved thoughts per message 8 2–16 candidates the model can cite
Follow-up groups all on Per-type toggles + 1–5 questions per group

Development

npm install
npm run dev      # esbuild watch mode
npm run build    # production bundle

Written in TypeScript, bundled with esbuild, graph rendering via Cytoscape.js. The plugin talks to AI providers directly (OpenAI-compatible chat completions, Gemini generateContent, Claude Messages API) with SSE streaming and non-streaming fallbacks.

Roadmap ideas

Potential future improvements include:

  • OpenAI-compatible endpoint support — custom base URL + key, unlocking local models (LM Studio, Ollama) and alternative providers (Mistral, Groq, OpenRouter) with one code path
  • Canvas / Excalidraw export — render the thought graph as an Obsidian Canvas file for presentations and sharing
  • Graph import/export — JSON dump/restore of nodes, edges, and metadata for backups and migration (the logic already exists internally)

Privacy

  • Notes never leave your vault except as explicit context in requests to your chosen AI provider, using your own API key.
  • Search, similarity, statistics, and the graph are computed entirely locally.

License

MIT © 2026 Kerekes Stefan

About

Turn markdown notes into a connected knowledge graph (DAG) with streaming AI chat. DeepSeek, OpenAI, Gemini, Claude — AI-suggested links, tags, statuses, and follow-up questions. Local BM25 search, no embeddings needed.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages