Skip to main content
Glama

om — Plugin-based Knowledge Base (Rewritten from Foam)

Cut the 66 modules of Super Brain v4 down to just the knowledge base core, rewritten on top of Foam, and plugin-based the DeepSeek Harness way:

  • Obsidian compatible — your vault is the knowledge base: plain markdown files + [[wikilinks]] + #tags + frontmatter

  • Zero dependencies — only uses Node's built-in node:sqlite (FTS5 full-text search, built-in Chinese tokenization)

  • Plugin-based — the core exposes a stable interface, users write their own plugins to extend (commands / MCP tools / events / index extractors)

  • AI-ready — MCP stdio server, directly callable from Claude Code / Cursor

Inspired by Foam (MIT): the wikilink parsing semantics and graph model are deeply inspired by it. This project is an independent rewrite (zero dependencies, no runtime dependencies), not a code fork.

Quick Start

cd ~/om
./core/cli.js init demo          # 初始化(demo 已有示例笔记)
./core/cli.js scan --vault demo  # 建索引
./core/cli.js search 图谱 --vault demo
./core/cli.js rename 图谱 知识图谱 --vault demo   # 重命名,全库双链自动更新
./core/cli.js deadlinks --vault demo             # 死链检查
./core/cli.js orphans --vault demo               # 孤岛笔记
./core/cli.js daily --vault demo                 # 今日笔记
./core/cli.js graph 插件系统 --vault demo
./core/cli.js backlinks 记忆系统 --vault demo
./core/cli.js tags --vault demo

Daily usage: cd <your-vault> && om search xxx (after npm link, the om command is available globally).

Related MCP server: mcp-vault-reader

MCP Integration (Claude Code)

// ~/.claude.json 的 mcpServers
{
  "om": {
    "command": "node",
    "args": ["/data/data/com.termux/files/home/om/core/cli.js", "mcp", "--vault", "/path/to/vault"]
  }
}

Built-in tools: search_notes / read_note / create_note / update_note / rename_note / delete_note / backlinks / graph_bfs / list_notes / list_tags, plus tools registered by plugins.

Architecture

vault/                        你的 Obsidian 库(文件即真身)
  .om/config.json             配置(插件开关等)
  .om/index.db                SQLite 索引(可随时删除重建)
  .om/plugins/                你的插件放这里
om/
  core/
    vault.js                  解析 frontmatter / [[双链]] / ![[嵌入]] / #标签
    tokenize.js               中文分词(CJK 单字+双字)+ FTS 查询构造
    db.js / indexer.js        SQLite 索引 + 增量扫描
    graph.js                  图谱查询(邻居 / backlinks / BFS)
    context.js                插件上下文(全部暴露接口)
    plugins.js                插件加载器(dsh 式)
    cli.js / mcp.js           CLI 与 MCP stdio 服务器
  plugins/                    内置示例插件(recent / todos)

Plugin Authoring Guide (Exposing the Interface)

A plugin = a JS file (ESM), default export { name, version, description, activate(ctx) }. Drop it in <vault>/.om/plugins/my-plugin.js, restart any om command and it takes effect. Set "plugins": {"my-plugin": false} in config.json to disable it.

Two quick commands:

om plugin create my-plugin    # 生成插件模板
om plugin install https://github.com/xxx/om-plugin-repo   # 从 git 仓库安装(仓库根目录需含 index.js)

activate(ctx) gives you the full API:

Interface

Description

ctx.notes

get(name) / search(q,{limit}) / create(name,{folder,content,tags}) / update(name,content) / remove(name) / list({tag})

ctx.graph

resolve(name) / neighbors(ref) / backlinks(ref) / bfs(ref,depth)

ctx.tags

list() / notes(tag)

ctx.storage

get/set/del(key) — plugin-private KV (namespaced per plugin)

ctx.events

on('note:save'|'note:delete', fn) — cross-plugin shared event bus

ctx.commands

register('name', async (args) => output) — add a new CLI subcommand

ctx.tools

register({name,description,inputSchema}, handler) — add a new MCP tool

ctx.index

register(({id,name,frontmatter,body,text}) => ({tags?,links?})) — index extractor, custom logic for extracting knowledge from notes

ctx.health

deadlinks() unresolved links / orphans() orphan notes

ctx.db

Raw SQLite handle (advanced)

ctx.vaultRoot / ctx.plugin

vault path / plugin name

Minimal Plugin Example

// <vault>/.om/plugins/hello.js
export default {
  name: 'hello',
  activate(ctx) {
    ctx.commands.register('hello', async () => `你好,库里有 ${ctx.db.prepare('SELECT COUNT(*) c FROM notes').get().c} 篇笔记`);
  },
};
$ om hello --vault demo
你好,库里有 5 篇笔记

Full examples in plugins/recent.js (commands + tools + storage + events) and plugins/todos.js (frontmatter / tag queries).

Testing

cd ~/om && node --test

Coverage: tokenization / vault parsing / indexing & incremental updates / graph / full plugin API / MCP end-to-end protocol.

Differences from Super Brain v4

Super Brain v4

om

Modules

66

10 core files + plugins

Architecture

6-channel cognitive neural system

pure knowledge base + dsh-style plugins

Storage

multiple custom stores

Obsidian-compatible markdown (files are the source of truth)

Dependencies

npm + pip + daemon

zero dependencies (node:sqlite)

Extensibility

not programmable

exposes interfaces, users write plugins

Known Limitations (Honest Disclosure)

  • Search is literal matching (FTS5 + Chinese single/double-character tokenization), not semantic search; synonym/concept search requires plugins or an external vector service

  • update_note automatically preserves the original frontmatter when updating the body; to overwrite the whole file, pass the --- frontmatter along with it

  • Renaming (rename / rename_note) automatically updates wikilinks pointing to it across the vault, but does not rewrite plain-text mentions in other files

  • Single-process design, no distributed/multi-device sync (the vault itself is plain files, so you can sync it yourself with git)

  • The index is a filesystem snapshot; after external editor changes, run om scan (or om watch) to refresh

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to manage a personal markdown-based knowledge base with natural language interactions. Supports creating, searching, updating, and organizing notes across categories like people, recipes, meetings, and procedures.
    11
    1
    -
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to search, read, and traverse Markdown note vaults (Obsidian-compatible) with full-text search, backlinks, knowledge graphs, and a persistent memory system for cross-session context.
    16
    8 npm
    2
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables reading, writing, searching, and managing Obsidian vault notes through MCP tools and prompts, allowing AI agents to interact with local knowledge bases.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to list, search, read, and append to Markdown notes through MCP tool calls, making it easy to interact with a second brain folder.
    -