Catalog npm
Back to packageRELEASE DETAILS

0.3.0

npm

@0xkobold/pi-codebase-wiki

Karpathy Wiki for codebases — auto-maintained knowledge base from git commits and code docs

pi-packageagentclicodebasekapywiki
Published13 Apr 2026
Direct dependencies3
Transitive dependenciesNot calculated

README

Current package documentation

📖 pi-codebase-wiki

Keeps a wiki for your code that updates itself — reads your git history and docs so you can ask questions about your codebase.

npm version License: MIT

The Idea

Instead of RAG retrieval that starts fresh on every query, you build a persistent, compounding wiki from your git history and code. Knowledge compiled once and kept current beats knowledge re-derived on every question.

pi-codebase-wiki reads your commits and docs, incrementally builds a structured wiki, and keeps it current as code changes. Works as a pi extension, a standalone CLI, or a programmatic library.

Three Ways to Use

1. As a pi Extension

For agents running inside pi — automatic context injection, tool calls, and commands.

pi install @0xkobold/pi-codebase-wiki

Then use tools like wiki_ingest, wiki_query, wiki_lint and commands like /wiki, /wiki-init, /wiki-ingest all.

2. As a CLI 🐹

Powered by kapy — agent-first, works in any terminal. No pi required.

Note: For string flags, use --flag=value syntax (e.g. --summary="My summary") to avoid parsing ambiguity with kapy's global arg scanner.

# Install globally
bun install -g @0xkobold/pi-codebase-wiki

# Initialize wiki in current project
wiki wiki-init

# Ingest sources
wiki ingest all

# Search the wiki
wiki query "Why did we switch from LevelDB to SQLite?"

# Health check
wiki lint

# Show stats
wiki status

# Create an entity page
wiki entity auth-module --summary="Handles user authentication" --type=module

# Create an ADR
wiki decision "Use SQLite over LevelDB" --context="Need reliable persistence" --choice="SQLite for durability"

# Generate changelog
wiki changelog --since="2 weeks ago"

# Trace feature evolution
wiki evolve auth

# Launch local web UI with graph visualization
wiki serve --port=3000 --open

# All commands support --json for machine-readable output
wiki status --json
wiki query "how does hot-reload work?" --json

Every command supports --json (structured output) and --no-input (non-interactive) — designed for agents and automation.

3. As a Library

Import the pure operations directly — no pi, no CLI, just functions.

import {
  initWiki,
  ingestCommits,
  ingestFileTree,
  searchWiki,
  lintWiki,
  WikiStore,
  getRecentCommits,
} from "@0xkobold/pi-codebase-wiki/core";

// Initialize
const store = new WikiStore(".codebase-wiki/meta/wiki.db");
await store.init();

// Ingest
const result = await ingestCommits(process.cwd(), config, store, "1 week ago");

// Query
const matches = searchWiki("how does auth work", wikiPath, store, 10);

// Lint
const issues = lintWiki(wikiPath, store);

Three-Layer Architecture

┌─────────────────────────────────────┐
│  Layer 1: Raw Sources (IMMUTABLE)  │  git log, source files, configs
├─────────────────────────────────────┤
│  Layer 2: The Wiki (LLM-OWNED)      │  .codebase-wiki/ — markdown pages
├─────────────────────────────────────┤
│  Layer 3: Schema (CO-EVOLVING)      │  .codebase-wiki/SCHEMA.md
└─────────────────────────────────────┘

Quick Start

# As a pi extension
pi install @0xkobold/pi-codebase-wiki
/wiki-init
/wiki-ingest all

# As a standalone CLI
bun install -g @0xkobold/pi-codebase-wiki
wiki wiki-init
wiki ingest all

CLI Commands

CommandDescription
wiki wiki-initInitialize .codebase-wiki/ for current project
wiki ingest [source]Ingest commits, tree, smart, llm, or all
wiki query <question>Search the wiki
wiki lintHealth check: orphans, stale pages, broken links
wiki statusShow page counts, staleness, last ingest
wiki entity <name>Create or update an entity page
wiki decision <title>Create an Architecture Decision Record
wiki concept <name>Create or update a concept page
wiki changelogGenerate changelog from recent commits
wiki evolve <feature>Trace feature evolution over time
wiki reindexRebuild the wiki index
wiki serveStart local web UI with graph visualization

pi Tools

ToolWhat It Does
wiki_ingestIngest commits, files, or docs into the wiki
wiki_querySearch the wiki and synthesize answers
wiki_lintHealth check: orphans, stale pages, broken links
wiki_statusShow wiki stats, staleness, coverage
wiki_entityCreate or update an entity page
wiki_decisionCreate an Architecture Decision Record (ADR)
wiki_conceptCreate or update a concept page
wiki_changelogGenerate changelog from recent commits
wiki_evolveTrace how a feature changed over time

pi Commands

CommandDescription
/wikiShow wiki status and INDEX.md
/wiki-initInitialize the wiki for the current project
/wiki-ingest [source]Ingest commits, tree, docs, or all
/wiki-query <question>Ask a question against the wiki
/wiki-lintRun health checks
/wiki-reindexRebuild the wiki index

Wiki Structure

.codebase-wiki/
├── SCHEMA.md            # The constitution (how the LLM maintains the wiki)
├── INDEX.md             # Master index with links to all pages
├── CHANGELOG.md         # Auto-generated from commits
├── entities/            # Code entity pages
│   ├── auth-module.md
│   └── event-bus.md
├── concepts/            # Cross-cutting concept pages
│   └── hot-reload-pattern.md
├── decisions/           # Architecture Decision Records
│   └── 001-sqlite-over-leveldb.md
├── evolution/           # How things changed over time
│   └── auth-evolution.md
├── comparisons/         # Side-by-side analysis
│   └── pi-learn-vs-generative-agents.md
├── templates/           # Page templates
│   ├── entity.md
│   ├── concept.md
│   ├── decision.md
│   └── evolution.md
└── meta/
    ├── LOG.md           # Ingest log
    ├── STATS.md         # Wiki health stats
    └── wiki.db          # SQLite metadata (sql.js)

How It Works

  1. Ingest: You add a source (commits, file tree, docs). The LLM reads it, extracts key information, and integrates it into the wiki — creating pages, updating cross-references, appending to the log. A single commit might touch 5-10 wiki pages.

  2. Query: You ask a question. The LLM searches the wiki (not the raw source), reads relevant pages, and synthesizes an answer. Good answers get filed back as new pages. Knowledge compounds.

  3. Lint: Periodic health checks find contradictions, orphans, stale pages, broken links, and missing concepts. Think of it as eslint for knowledge.

Key Principle

The LLM writes. You read. You curate sources and ask questions. The LLM does the bookkeeping.

Web UI

wiki serve launches a local web interface with:

  • Page browser — sidebar with all pages, type-coded dots (entity, concept, decision, etc.)
  • Content viewer — rendered markdown with clickable [[wikilinks]] and metadata
  • Full-text search — search across all pages with relevance scoring
  • Interactive graph — force-directed node graph showing how pages connect, drag nodes, zoom, double-click to navigate
  • Dark mode — because we live in terminals
wiki serve              # Start on port 3000
wiki serve --port=8080 # Custom port
wiki serve --open      # Auto-open browser

All data comes from the API (/api/pages, /api/graph, /api/search). The UI is a single HTML page — no build tools, no external deps.

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 3

Native requirements
3 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
sql.js
Environment
{
  "local_name": "sql.js",
  "alias": false,
  "peer_metadata": null
}
^1.11.0runtime
@sinclair/typebox
Environment
{
  "local_name": "@sinclair/typebox",
  "alias": false,
  "peer_metadata": null
}
>=0.32.0peer
@mariozechner/pi-coding-agent
Environment
{
  "local_name": "@mariozechner/pi-coding-agent",
  "alias": false,
  "peer_metadata": null
}
>=0.62.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "d2486db8a0d1fc721ba9d3c912dbe2fea8afb80d",
  "tarball": "https://registry.npmjs.org/@0xkobold/pi-codebase-wiki/-/pi-codebase-wiki-0.3.0.tgz",
  "fileCount": 16,
  "integrity": "sha512-JjNHtxqL+PoqUSWU7NtpqGXHRAudl01UR2cZla73eim1jDx/j/M1zl+nw8lNKeahwZ7GetLwbJOG6tCmqzLzew==",
  "signatures": [
    {
      "sig": "MEYCIQCof9CWXiiLPybmdc/UgBizsDjhkxEi9vYa8s2C5B23TwIhAPVl+e9hY5gavKPo1DXdc3dIvB0YWrYM3yCp+wCuagtH",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 161979
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:02 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:ede8aaa889b07aa440256367bb2c4284e22583c91f3b33fee47fb2d3bb9fc029

Other collected versions

0.8.717 May0.8.617 May0.8.517 May0.8.417 May0.8.317 May0.8.217 MayView all collected versions →