explaingit

dheerapat/pi-kb

18TypeScriptAudience · developerComplexity · 2/5ActiveSetup · easy

TLDR

Extension for the pi coding agent that turns markdown files and URLs into a local wiki with summaries, cross-document concepts, and an index, stored as plain markdown in your home folder.

Mindmap

mindmap
  root((pi-kb))
    Inputs
      Markdown files
      URLs
      Slash commands
    Outputs
      Summaries
      Concepts file
      Workspace index
    Use Cases
      Build a personal docs wiki
      Query saved docs anywhere
      Sync wiki via Git
    Tech Stack
      TypeScript
      pi agent
      html-to-markdown

Things people build with this

USE CASE 1

Build a personal knowledge base from project READMEs and design docs that pi can query from any folder.

USE CASE 2

Pull blog posts and Wikipedia pages into a workspace via /kb-add and ask grounded questions with /kb-query.

USE CASE 3

Keep multiple isolated wikis (work, research, hobby) and switch between them with the -w flag.

USE CASE 4

Version the ~/.pi/agent/kb/wiki folder with Git or open it in Obsidian for a graph view of your notes.

Tech stack

TypeScriptpi

Getting it running

Difficulty · easy Time to first run · 5min

The only requirement is the pi coding agent itself, and dynamic single-page-app URLs will produce thin results.

In plain English

pi-kb is an add-on for a coding tool called pi, which the README describes as a coding agent that runs on your machine. The job of pi-kb is to take a pile of markdown files (or web pages) and turn them into a small wiki, with summaries, cross-cutting concepts, and an index, using whichever language model pi is already wired up to. The author says they were inspired by an earlier project called OpenKB, but built this one entirely as a pi extension with no extra dependencies beyond the model. You install it with one command, pi install git:github.com/dheerapat/pi-kb. After that you get a set of slash commands. /kb-init creates a named workspace. /kb-add takes either a local markdown file or a URL and pulls it into the knowledge base. /kb-query asks a question against the stored documents. There are also commands to list documents, show stats, remove a document, and delete a whole workspace, the last of which asks for confirmation first. Every command can take a -w flag to point at a specific workspace, otherwise it uses a default one. When you add a file, pi-kb copies it into a folder under your home directory, then asks the language model to write a summary, pull out concepts that show up across documents, and update the index. Everything is stored as plain markdown in ~/.pi/agent/kb/wiki/, so you can open the folder in a tool like Obsidian to get a graph view. URLs are fetched with a plain HTTP request and converted to markdown by a separate Rust library called html-to-markdown. The README is honest that this works well for documentation sites, Wikipedia, blog posts, and GitHub READMEs, but will produce thin or empty results for sites built as single-page apps, anything behind a login, or pages guarded by bot-detection. Because the knowledge base lives in a fixed location in your home directory, you can run queries from any folder on your machine, not just inside the project the documents came from. And because it is all plain files, you can put the folder under Git to keep history, back it up, or sync it across machines. The only listed requirement is the pi coding agent itself.

Copy-paste prompts

Prompt 1
Install pi-kb with pi install git:github.com/dheerapat/pi-kb, create a workspace called rust-notes, and load three URLs from the Rust book into it.
Prompt 2
Add every markdown file in ./docs to a pi-kb workspace called product, then ask /kb-query 'which document covers retention policy?'
Prompt 3
Write a short bash script that exports a named pi-kb workspace to a Git repo nightly and pushes it as a backup.
Prompt 4
Explain why pi-kb cannot ingest a single-page app or a login-gated page, and suggest a workaround that still uses html-to-markdown.
Prompt 5
Compare pi-kb against OpenKB and the built-in Obsidian vault search for a solo developer keeping research notes on Linux.
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.