npm package: @kibhq/cli
Description: The Headless Knowledge Compiler — turn raw sources into a structured, queryable wiki with AI
Latest version: 1.1.0

# kib

The Headless Knowledge Compiler. A CLI-first, LLM-powered tool that turns raw source material into a structured, queryable markdown wiki — maintained entirely by AI.

`git` for knowledge — ingest, compile, query, lint, all from the terminal.

## Install

```bash
# Requires Bun (https://bun.sh)
npm i -g @kibhq/cli

# or run without installing
npx @kibhq/cli init
```

Standalone binaries for macOS and Linux are available on the [releases page](https://github.com/keeganthomp/kib/releases).

## Quick Start

```bash
# Initialize a vault (creates ~/.kib by default)
kib init

# Ingest sources (URLs, files, PDFs, YouTube, GitHub repos, images)
kib ingest https://arxiv.org/abs/1706.03762
kib ingest ./papers/*.pdf
kib ingest https://www.youtube.com/watch?v=...
kib ingest ./whiteboard.png

# Compile into wiki articles
kib compile

# Search your knowledge base
kib search "attention mechanisms"

# Ask questions (RAG over your wiki)
kib query "what are the tradeoffs between MoE and dense models?"

# Interactive chat
kib chat
```

## Commands

```
CORE
  init [dir]          Create a new vault (defaults to ~/.kib)
  ingest <source>     Ingest sources into raw/ (URLs, files, PDFs, etc.)
  compile             Compile raw sources into wiki articles via LLM
  query <question>    Ask a question against the knowledge base (RAG)
  search <term>       Fast BM25 text search across the vault
  chat                Interactive REPL with conversation history
  lint                Run health checks on the wiki
  status              Vault health dashboard

INTEGRATION
  serve               Start MCP server for AI tool integration
  mcp                 Configure MCP in AI clients (auto-runs on init)
  watch               Passive learning daemon — auto-ingest and compile

MANAGEMENT
  config [key] [val]  Get or set configuration
  skill <sub> [name]  Manage skills (install, list, run, create)
  export              Export wiki to markdown or HTML
```

### Export

```bash
# Export as clean markdown
kib export --format markdown

# Export as HTML static site (with image gallery)
kib export --format html
```

HTML export includes image assets with proper relative paths and generates a browsable image gallery page.

### Watch Daemon

Run a background daemon that monitors your inbox, external folders, and an HTTP endpoint for new content — automatically ingesting and compiling it.

```bash
kib watch               # foreground (logs to terminal)
kib watch --daemon      # background daemon
kib watch --status      # check if running
kib watch --stop        # stop daemon
kib watch --install     # install as system service (launchd/systemd)
kib watch --uninstall   # remove system service
```

**Ingestion channels:**
- **Inbox** — drop files into `inbox/` (picks up files added while daemon was off)
- **HTTP** — `POST localhost:4747/ingest` with `{ content, title?, url? }`
- **Folder watchers** — monitor external directories with glob patterns

**Auto-compile** triggers after a configurable number of new sources or idle timeout. Configure via `[watch]` section in `.kb/config.toml`.

## LLM Providers

On first use, kib walks you through provider setup interactively. Or set via environment:

| Provider | Env Variable | Default Model |
|----------|-------------|---------------|
| Anthropic | `ANTHROPIC_API_KEY` | claude-sonnet-4-6 |
| OpenAI | `OPENAI_API_KEY` | gpt-4o |
| Ollama | (auto-detect localhost:11434) | llama3 |

## Vault Structure

```
my-vault/
├── .kb/                  # Config, manifest, cache
├── raw/                  # Ingested source material (never modified by compile)
│   ├── articles/
│   ├── papers/
│   ├── transcripts/
│   ├── repos/
│   └── images/
├── wiki/                 # LLM-compiled knowledge base
│   ├── INDEX.md          # Master index
│   ├── GRAPH.md          # Article relationship graph
│   ├── images/           # Image assets (originals from ingested images)
│   ├── concepts/
│   ├── topics/
│   ├── references/
│   └── outputs/
└── inbox/                # Drop zone for kib watch
```

The vault is just files. View it in any editor. Version it with git. No lock-in.

## MCP Server

Give your AI assistant direct access to your knowledge base. `kib init` auto-configures Claude Code, Claude Desktop, and Cursor — no extra step needed.

Already have a vault? Run `kib mcp` to configure MCP clients without re-initializing.

Restart your AI client and it can search, query, ingest, and compile your vault.

11 tools: `kib_status`, `kib_list`, `kib_read`, `kib_search`, `kib_query`, `kib_ingest`, `kib_compile`, `kib_lint`, `kib_config`, `kib_skill`, `kib_export`

3 resources: `wiki://index`, `wiki://graph`, `wiki://log`

<details>
<summary>Manual setup (other clients)</summary>

```json
{
  "mcpServers": {
    "kib": {
      "command": "kib",
      "args": ["serve"],
      "cwd": "/path/to/your/vault"
    }
  }
}
```

</details>

## Links

- [GitHub](https://github.com/keeganthomp/kib)
- [Roadmap](https://github.com/keeganthomp/kib/blob/main/ROADMAP.md)
- [@kibhq/core](https://www.npmjs.com/package/@kibhq/core) — core engine (for programmatic use)

## License

MIT