我用 WorkBuddy + Obsidian,搭了一个会自己生长的个人知识库I built a self-growing personal knowledge base with WorkBuddy + Obsidian


AI free token/AI免费积分

对AI感兴趣同学可以看下小店1元的商品。karpathy之前发布了一条帖子表示,最近绝大部分 Token 消耗从写代码转向利用 LLMs 构建个人知识库,这条推文引起了大量的关注,很快就高达1700多万阅读。

抛开karpathy自带流量因素之外,从另外一个角度也说明,在构建AI知识库这个场景还远没有被满足,有很多的人都受困于知识管理。

次日,karpathy就在Github上面公开了LLM wiki 的构想文件,详细的阐述了这套知识库构建方案的架构和理念。

到目前为止,网上也有很多关于这套理念的实践,比如使用Obsidian + Claudidan + LLM wiki来构建第二大脑,但是Claude Code对于很多同学来说上手门槛确实有点高,本篇文章我们把门槛降低一点,使用WorkBuddy  + LLM wiki + Obsidian来做实践。

首先,我们先大致先了解下LLM wiki 是个啥东西。

图片

他的核心观点是,传统的RAG系统和NotebookLM/ChatGPT文件上传功能,大部分都是先上传资料,查询时召回相关知识片段,然后临时综合性回答。

但问题是,每次问问题,模型都是在重新从碎片里临时拼答案,知识并没有被持续沉淀下来。

karpathy 提出的LLM wiki 则是:我们负责收集原始资料,大模型读取这些资料,然后增量维护一个结构化的Wiki,不断的更新实体页、主题页、交叉引用、矛盾点和综合结论。

也就是说,他不再是查询时临时拼答案,而是提前把知识编译成一个可持续演化的知识结构。相当于一次编译,持续复用,知识像滚雪球一样越滚越大。

另外,LLM Wiki 并不是一次性把所有资料重新总结一遍,而是做增量更新,编译新的知识时,Agent 会先判断它对应哪些已有实体、概念和主题,再决定是更新旧页面,还是创建新页面;如果新旧资料的说法不一致,也不会直接覆盖,而是同时保留来源、时间和适用范围,并给出冲突提示。

图片

他的整体架构分为三个层级:

  1. Raw层用于存放采集的原始资料,比如我们看到的文章、论文、图像、数据文件、以及聊天记录等,这些内容是不可变的,LLM只负责读取但是不会修改它们,这些内容是整个知识体系的事实来源。
  2. Wiki层相当编译层,用于存放由LLM处理后的结构化知识,包含摘要、实体页面、概念页面、比较、概述、综合理解等,这一层主要是由LLM维护更新。
  3. Schema层,这一层相当于是Claude Code 的CLAUDE.md或者Codex的AGENTS.md,它告诉大模型Wiki的结构、约定以及处理资料来源、问题回答或者维护wiki时应该遵循的工作流程。

简单来说,raw层提供原始材料,我们负责往里面存放;wiki层是加工品,由AI负责把原材料编译成结构化的知识;schema层是生产规范,指导AI怎么加工。

图片

以上就是关于LLM wiki的核心理念,大家有一个简单的认知,下面我们继续看如何实践。

依赖工具

实践过程中,我们需要使用Workbuddy、Obsidian、Obsidian Web Clipper这些工具,其中Workbuddy、Obsidian到对应的官网下载安装即可,Obsidian Web Clipper是一款浏览器插件,需要到Chrome扩展商店下载,主要用于把网页内容提取为Markdown格式并保存到Obsidian Vault中。

初始化工程

首先我们打开 Obsidian,点击【创建】,在指定文件夹下创建一个新的仓库,这里命名为kb-wiki,并使用Git版本管理工具初始化仓库,便于后续管理版本记录。

图片

然后打开WorkBuddy,新建一个会话,工作空间选择刚刚在Obsidian中创建的项目文件夹。

图片

这样Obsidian、WorkBuddy这两个软件的工作空间都指向了同一个本地目录,只不过现在文件夹还是空的,我们继续往下。

整体架构

根据前面的LLM Wiki的原则,我们在Obsidian中把目录文件层级设置为如下结构:

图片

其中AGENTS.md就相当于Schema层,是指导WorkBuddy维护wiki的工作原则;index.md是wiki内容的索引文件,便于快速找到目标内容;log.md是用于记录每次操作的记录,比如什么时间写入了什么知识、新增了哪些内容等;

raw存放原始资料,里面的目录结构可以自定义,根据自己的实际需求进行分类;wiki就是经过AI编译后结构化知识;templates用于给AI生成wiki时参考的模板文件,与wiki下面的目录结构一一对应。

整体的目录结构和职责划分还是很简单清晰的,我们在看整体的工作流程是怎么样的:

图片

其中workbuddy的职责就是承担编译器,负责对原始资料进行加工,当然也可以用Claude Code、Codex等Agent工具;而Obsidian更多的承担编辑器和UI视图的职责,提供双向链接的功能,并以可视化的方式呈现知识之间的关系,还提供其它查询类的操作。

图片

可以看出,整体流程中最为关键是,数据怎么采集、知识怎么加工、用什么模型加工、如何被查询、怎么保持加工的质量能够稳定持续。下面我们围绕这些方面进一步展开。

编写Wiki Schema

前面说过,Wiki Schema层相当于就是定义AGENTS.md文件,指导Agent如何工作。可以说这是整个Wiki系统的灵魂,它负责告诉Workbuddy的角色是啥、目录结构怎么维护、从哪里读取素材、素材怎么编译、摘要怎么写、链接怎么创建等等。

下面是一份部分示例:

图片

把上面的内容编写到项目的根目录AGENTS.md中,这个文件的内容并不是一劳永逸或者一蹴而就的,需要我们持续的维护更新,直到表现稳定。

数据采集

前面我们已经把项目的目录结构和AGENTS.md定义清楚后,项目的主体结构就搭建完成,接下来就可以开始采集数据了。

这一步主要看我们的搭建知识库的目的是什么,这决定了我们需要采集哪些数据。

如果是用于构建个人第二大脑,那需要采集的数据要求就很多,比如我们每天看过的重要文章、视频、参与过的会议、聊天、通话、文字记录等信息;如果是做专题研究学习,那么仅收集查阅过的优质论文、文章、报告即可。

而收集的这些数据可能存在多个平台上,非常分散,想要把这些信息放入到项目的raw目录中,还是很费劲的,这里我们可以借助IMA和Obsidian Web Clipper用来收集整理数据。

比如,在电脑端浏览器中,我看到一篇优质的文章,我想把它加入我的知识库项目原始资料中,就可以使用Obsidian Web Clipper插件把网页内容以markdown的格式直接添加到项目的raw目录中。

图片

而在移动端,我的大多数内容来自微信公众号,我想把优质的内容加入项目中,操作路径相对更长,得先把这篇公众号链接发送到电脑端,然后在电脑端用浏览器打开,在用Obsidian Web Clipper插件收藏到raw中。整个操作流程是断裂的,有时候还会忘记在电脑端进行操作,有价值的文章内容就流失掉了。

这里我们可以使用IMA知识库作为中转站,用来收集移动端的内容,把在微信中看到的各类信息一键收藏到IMA知识库中,这个方法对于微信生态的内容尤其友好。

然后我们还要借助Workbuddy的定时任务,定期的从IMA知识库中把新增的内容同步到项目raw目录中来,自动化任务设置大致如下:

图片

这样我们就能同时收集到电脑端和移动端看到的多数优质内容了。

除了上面提到的两种情况外,内容可能存在其它平台上,比如飞书文档或钉钉文档中,我们可以借助这些平台的CLI工具 + Workbuddy自动化任务来实现数据的同步,方式方法很多,就不一一列举了。

此外,我们收集数据格式可能存在多样性,有文档、图片、视频、音频、PPT、PDF、聊天记录等,关键是要把这些格式的内容识别为文本,这里可以借助多模态模型进行解析,便于后续模型加工处理。

需要注意的是,原始资料的质量决定了Wiki的质量,这里的核心原则是,只收集高质量的内容,宁缺勿滥,否则我们的知识库就变成了垃圾进垃圾出。

这里我通过Obsidian Web Clipper插件,把之前写过的所有关于知识库和RAG的微信公众号文章都放入到项目的原始资料中来。

图片

编译知识

原始资料采集完成后,我们就可以开始让WorkBuddy编译知识了。

图片

打开WorkBuddy,把工作空间指向kb-wiki这个目录,在会话中告诉它:

阅读当前项目raw/中新增的文件,按照项目根目录中的AGENTS.md的规范,将它们编译到wiki/目录中,并同时更新index.md和log.md文件

WorkBuddy 就会阅读这些原始资料,提炼出概念和实体知识,并为每个有效来源创建摘要信息,并在每个页面之间创建[[wikilinks]]双向链接,这里生成的一系列的Markdown 文件,都会放到 wiki 这个文件夹下。

此外,还会更新知识wiki的索引文件index.md,以及把本次知识写入日志更新到log.md中。

生成的这些文件并不是散乱的,彼此之间会用双向链接关联起来,我们在编辑器中查看不够直观,但是在Obsidian中使用关系图谱功能查看,就会以下图这样的知识图谱形式展示,我们可以看到不同知识点、不同资料之间的关联,点击某个知识点,还可以直接跳转到对应知识文件去。

图片

到这一步就完成了知识的摄取,接下来我们看如何查询知识。

查询知识

查询这里就非常简单了,直接向WorkBuddy提问即可,它会根据wiki中沉淀下来的知识,进行综合回答。

比如我问:

根据 Wiki,解释一下LLM wiki的工作原理是什么,它与传统的RAG有啥区别?

下面是回答截图:图片

可以看到索引文件index.md,在查询时就派上用场了,WorkBuddy在查询时会先读这个索引文件,判断哪些页面跟当前问题相关,然后在进一步读取,这与我们从目录结构找到对应的章节知识是类似的做法,可以大幅提高检索的效率。

这里Wiki 页面的渐进式展开和 Skills 的渐进式披露的机制也非常一致。

当然,这里生效的前提是,我们要在AGENTS.md中定义查询的工作流程,让Agent先查index.md,然后在加载wiki中的相关知识。

图片

另外,对于有价值的回答,还可以把结论写回wiki,让知识越攒越厚。

治理知识

知识治理则是让Workbuddy定期检查一遍,看整个知识库wiki有没有矛盾、有没有孤立页面,链接有没有断,保证知识库不会因为资料越多就越乱。

这里可以通过Workbuddy的定时任务来实现自动化健康检查,比如每周检查一次,定时任务设置如下:

图片

知识健康检查指令大致如下:

图片

在企业场景中,LLM wiki的局限

在LLM wiki概念出现之后,又有一大批自媒体在自嗨,宣称RAG已死,认为LLM wiki可以完全替代RAG做企业知识库,成为企业知识库的新架构。但从我目前的感受来看,LLM wiki这套理念还是更适合构建个人知识管理的需求,放在企业场景中还是不太适合。

图片

首先,数据规模的限制是一道门槛,当wiki文档数量膨胀到成百上千个时,每次新增知识编译或者查询时,Token的消耗会显著上升,甚至Index.md的索引内容可能就会撑爆上下文窗口,存在高昂的成本和性能压力。

其次,就是权限管理,企业级的知识库通常需要权限访问控制,而LLM Wiki目前对细粒度的访问控制支持还不完善,难以满足企业级安全合规要求。

另外,知识引用的可溯源性也存在隐患,企业场景对来源追溯要求很高,尤其是医疗、法律等严肃场景,RAG方案可以明确这个回答是基于哪个文档中的那一段内容,而LLM Wiki生成的内容本质上依赖于模型对原始知识的理解与重构,是极有可能出现幻觉的,存在生成错误知识关联的风险。一旦这类偏差被写入Wiki,就可能会误导后续所有查询结果。

因此,LLM wiki的使用还是要分场景的,对于个人知识库构建、学习研究等低风险场景中,效率高、体验好。但是对于企业知识库构建就需要评估了,根据数据规模以及权限要求、引用准确性来确定。

总结

这套个人知识库构建方案,改变了我们对知识处理的方式,以前我们把看到的优质内容放进收藏夹,等到需要时再临时搜索,但大概率再也没打开过。而现在让Agent持续参与知识的整理、连接和更新,让每一份新的资料都能和已有知识产生关系。

建议大家先从一个小主题开始,跑通本文说到的采集、编译、查询和治理的完整流程,再根据实际使用中的问题逐步调整,而不是一开始就追求一个大而全的知识库。

以上就是使用WorkBuddy + LLM wiki + Obsidian搭建知识库的一次简单实践,后续我们在对每个环节进行深入讨论。

 

For those interested in AI, check out the 1-yuan item in our shop. Karpathy previously posted that recently, the vast majority of token consumption has shifted from writing code to using LLMs to build personal knowledge bases. This tweet attracted a great deal of attention and quickly reached over 17 million views.

Aside from Karpathy's built-in traffic factor, this also shows from another angle that the scenario of building AI knowledge bases is far from satisfied, and many people are struggling with knowledge management.

The next day, Karpathy publicly released the LLM wiki concept document on GitHub, explaining in detail the architecture and philosophy of this knowledge base construction approach.

So far, there are also many online practices based on this concept, such as using Obsidian + Claudidan + LLM wiki to build a second brain. However, Claude Code is indeed quite challenging for many people to get started with. In this article, we will lower the barrier a bit and use WorkBuddy + LLM wiki + Obsidian for practice.

First, let's roughly understand what LLM wiki is.

Its core viewpoint is that traditional RAG systems and NotebookLM/ChatGPT file upload features mostly work by uploading materials first, recalling relevant knowledge fragments during queries, and then giving temporary comprehensive answers.

But the problem is that every time you ask a question, the model is reassembling answers from fragments on the fly, and knowledge is not continuously accumulated.

Karpathy's proposed LLM wiki works like this: we are responsible for collecting raw materials, the large model reads these materials, and then incrementally maintains a structured Wiki, continuously updating entity pages, topic pages, cross-references, contradictions, and synthesized conclusions.

In other words, it no longer assembles answers temporarily at query time, but instead compiles knowledge in advance into a continuously evolving knowledge structure. It is equivalent to compiling once and reusing continuously, with knowledge growing like a snowball.

In addition, LLM Wiki does not re-summarize all materials at once. Instead, it performs incremental updates. When compiling new knowledge, the Agent first determines which existing entities, concepts, and topics it corresponds to, and then decides whether to update old pages or create new pages. If new and old materials are inconsistent, it does not directly overwrite them; instead, it retains the source, time, and scope of applicability while giving conflict alerts.

Its overall architecture is divided into three layers:

The Raw layer is used to store collected raw materials, such as articles, papers, images, data files, and chat records we have seen. These contents are immutable; the LLM only reads them but does not modify them. These contents are the source of truth for the entire knowledge system.

The Wiki layer is equivalent to the compilation layer, used to store structured knowledge processed by the LLM, including summaries, entity pages, concept pages, comparisons, overviews, comprehensive understanding, etc. This layer is mainly maintained and updated by the LLM.

The Schema layer is equivalent to Claude Code's CLAUDE.md or Codex's AGENTS.md. It tells the large model the structure of the Wiki, the conventions, and the workflow to follow when processing source materials, answering questions, or maintaining the wiki.

In simple terms, the raw layer provides raw materials, and we are responsible for storing them; the wiki layer is the processed product, where the AI is responsible for compiling raw materials into structured knowledge; the schema layer is the production specification that guides how the AI processes them.

The above is the core concept of LLM wiki. Now that you have a simple understanding, let's continue to see how to practice it.

Dependent tools

During the practice, we need to use tools such as Workbuddy, Obsidian, and Obsidian Web Clipper. Workbuddy and Obsidian can be downloaded and installed from their official websites. Obsidian Web Clipper is a browser extension that needs to be downloaded from the Chrome Web Store. It is mainly used to extract web page content into Markdown format and save it to an Obsidian Vault.

Initializing the project

First, open Obsidian, click [Create], and create a new vault in a specified folder. Here we name it kb-wiki and use Git version control to initialize the repository for easier version management later.

Then open WorkBuddy, create a new session, and set the workspace to the project folder just created in Obsidian.

In this way, the workspaces of both Obsidian and WorkBuddy point to the same local directory, except that the folder is still empty. Let's continue.

Overall architecture

According to the LLM Wiki principles mentioned earlier, we set the directory hierarchy in Obsidian as follows:

Among them, AGENTS.md is equivalent to the Schema layer and serves as the working principle that guides WorkBuddy to maintain the wiki; index.md is the index file for wiki content, making it easy to quickly find target content; log.md records each operation, such as what knowledge was written and when, and what new content was added.

raw stores raw materials, and its internal directory structure can be customized according to actual needs; wiki is the structured knowledge compiled by AI; templates provides template files for AI to reference when generating wiki content, corresponding one-to-one with the directory structure under wiki.

The overall directory structure and responsibility division are still simple and clear. Let's look at the overall workflow:

WorkBuddy's responsibility is to act as the compiler, processing raw materials. Of course, Agent tools such as Claude Code and Codex can also be used. Obsidian mainly takes on the responsibilities of an editor and UI view, providing bidirectional links, visualizing the relationships between knowledge in a visual way, and offering other query operations.

It can be seen that the most critical parts of the overall process are how data is collected, how knowledge is processed, which model is used for processing, how it is queried, and how to maintain stable and continuous processing quality. Below, we will expand on these aspects.

Writing the Wiki Schema

As mentioned earlier, the Wiki Schema layer is equivalent to defining the AGENTS.md file to guide how the Agent works. It can be said to be the soul of the entire Wiki system. It is responsible for telling Workbuddy what its role is, how the directory structure should be maintained, where to read materials from, how materials should be compiled, how summaries should be written, how links should be created, and so on.

The following is a partial example:

Write the above content into the AGENTS.md file in the project root directory. The content of this file is not something you can set once and forget, nor is it completed in one go. It requires continuous maintenance and updates until performance is stable.

Data collection

After defining the project directory structure and AGENTS.md, the main structure of the project is set up. Next, we can start collecting data.

This step mainly depends on what the purpose of building the knowledge base is, which determines what data we need to collect.

If it is for building a personal second brain, then the data collection requirements are extensive. For example, we need important articles and videos we watch every day, meetings we attended, chats, phone calls, text records, and other information. If it is for special topic research and study, then we only need to collect high-quality papers, articles, and reports we have consulted.

However, the collected data may exist on multiple platforms and be very scattered. Putting this information into the raw directory of the project can be quite troublesome. Here we can use IMA and Obsidian Web Clipper to help collect and organize data.

For example, on a computer browser, if I see a high-quality article and want to add it to the raw materials of my knowledge base project, I can use the Obsidian Web Clipper plugin to directly add the web page content to the project's raw directory in Markdown format.

On mobile, most of my content comes from WeChat official accounts. If I want to add high-quality content to the project, the operation path is relatively longer. I first need to send the WeChat article link to the computer, then open it in a browser on the computer, and then use the Obsidian Web Clipper plugin to save it to raw. The entire operation flow is fragmented, and sometimes I forget to do it on the computer, causing valuable article content to be lost.

Here we can use the IMA knowledge base as a relay station to collect mobile content. We can one-click save various information seen in WeChat to the IMA knowledge base. This method is especially friendly to WeChat ecosystem content.

Then we also need to use Workbuddy's scheduled tasks to periodically sync new content from the IMA knowledge base to the project's raw directory. The automation task settings are roughly as follows:

In this way, we can simultaneously collect most of the high-quality content we see on both computer and mobile.

In addition to the two situations mentioned above, content may exist on other platforms, such as Feishu documents or DingTalk documents. We can use CLI tools from these platforms plus Workbuddy automation tasks to achieve data synchronization. There are many methods, so I won't list them all.

In addition, the data formats we collect may be diverse, including documents, images, videos, audio, PPTs, PDFs, chat records, etc. The key is to recognize the content in these formats as text. Multimodal models can be used for parsing to facilitate subsequent model processing.

It should be noted that the quality of raw materials determines the quality of the Wiki. The core principle here is to only collect high-quality content, rather than collecting everything. Otherwise, our knowledge base becomes garbage in, garbage out.

Here I use the Obsidian Web Clipper plugin to put all my previous WeChat official account articles about knowledge bases and RAG into the project's raw materials.

Compiling knowledge

After raw material collection is completed, we can start letting WorkBuddy compile knowledge.

Open WorkBuddy, point the workspace to the kb-wiki directory, and tell it in the session:

Read the newly added files in the current project's raw/ directory, compile them into the wiki/ directory according to the AGENTS.md specification in the project root directory, and also update the index.md and log.md files.

WorkBuddy will read these raw materials, extract conceptual and entity knowledge, create summary information for each valid source, and create [[wikilinks]] bidirectional links between each page. The series of Markdown files generated here will all be placed in the wiki folder.

In addition, it will update the knowledge wiki index file index.md and write this knowledge update into log.md.

These generated files are not scattered; they are linked to each other through bidirectional links. When viewed in an editor, it is not intuitive enough, but when viewed with the graph view feature in Obsidian, it is displayed as a knowledge graph like the one below. We can see the relationships between different knowledge points and materials. Clicking a knowledge point can directly jump to the corresponding knowledge file.

At this point, knowledge ingestion is complete. Next, let's look at how to query knowledge.

Querying knowledge

Querying is very simple here. Just ask WorkBuddy directly, and it will provide comprehensive answers based on the knowledge accumulated in the wiki.

For example, I ask:

According to the Wiki, explain how LLM wiki works and what differences it has from traditional RAG.

Below is a screenshot of the answer:图片

It can be seen that the index file index.md comes in handy during queries. When WorkBuddy queries, it first reads this index file, determines which pages are relevant to the current question, and then reads further. This is similar to finding corresponding chapter knowledge from a directory structure and can greatly improve retrieval efficiency.

Here, the progressive expansion of Wiki pages and the progressive disclosure mechanism of Skills are also very consistent.

Of course, the premise for this to work is that we need to define the query workflow in AGENTS.md, so that the Agent first checks index.md and then loads relevant knowledge from the wiki.

In addition, for valuable answers, we can also write the conclusions back to the wiki, making knowledge accumulate thicker over time.

Knowledge governance

Knowledge governance means having Workbuddy periodically check the entire knowledge base wiki for contradictions, orphan pages, broken links, and ensuring that the knowledge base does not become messier as more materials are added.

This can be automated through Workbuddy's scheduled tasks, such as a health check once a week. The scheduled task settings are as follows:

The knowledge health check instruction is roughly as follows:

Limitations of LLM wiki in enterprise scenarios

After the LLM wiki concept appeared, another wave of self-media people got excited and claimed that RAG is dead, believing that LLM wiki can completely replace RAG for enterprise knowledge bases and become the new architecture for enterprise knowledge bases. But from my current experience, the LLM wiki concept is still more suitable for personal knowledge management needs, and it is not very suitable for enterprise scenarios.

First, the limitation of data scale is a threshold. When the number of wiki documents expands to hundreds or thousands, token consumption increases significantly each time knowledge is compiled or queried. In extreme cases, the index.md content alone may blow up the context window, creating high cost and performance pressure.

Second, there is permission management. Enterprise-level knowledge bases usually require access control, but LLM Wiki currently has incomplete support for fine-grained access control, making it difficult to meet enterprise security and compliance requirements.

In addition, the traceability of knowledge citations also has hidden dangers. Enterprise scenarios have very high requirements for source traceability, especially in serious fields such as healthcare and law. RAG solutions can clearly indicate which document and which passage an answer is based on, while LLM Wiki generated content essentially relies on the model's understanding and reconstruction of original knowledge, making hallucinations highly possible and creating risks of generating incorrect knowledge associations. Once such deviations are written into the Wiki, they may mislead all subsequent query results.

Therefore, LLM wiki should still be used according to the scenario. For low-risk scenarios such as personal knowledge base construction, learning, and research, it is efficient and provides a good experience. However, for enterprise knowledge base construction, it needs to be evaluated based on data scale, permission requirements, and citation accuracy.

Summary

This personal knowledge base construction approach changes the way we handle knowledge. Previously, we put high-quality content we saw into favorites and searched for it temporarily when needed, but most of the time we never opened it again. Now we let Agents continuously participate in organizing, connecting, and updating knowledge, allowing every new piece of material to relate to existing knowledge.

I suggest everyone start with a small topic, run through the complete flow of collection, compilation, query, and governance described in this article, and then gradually adjust based on actual problems encountered in use, rather than pursuing a large and comprehensive knowledge base from the beginning.

The above is a simple practice of building a knowledge base using WorkBuddy + LLM wiki + Obsidian. In the future, we will discuss each part in more depth.

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

图片

暂无评论,快来发表第一条评论吧!No comments yet. Be the first!

📮 需求咨询📮 Inquiry