CLI-First Knowledge Base

memex

Hybrid search, typed relations, static publishing. Built for humans and AI agents.

pip install memex-kb
kb/guide
ref/api
design
kb/search
patterns
troubleshoot

Designed for Clarity

Everything you need to manage knowledge, nothing you don't.

Hybrid Search

BM25 keyword search combined with semantic embeddings, merged with Reciprocal Rank Fusion.

keyword + vector + rrf

Typed Relations

Explicit directed links in frontmatter with CLI helpers and linting.

depends_on, implements, documents...

Graph View

Wikilinks, relations, and semantic links queryable via CLI and published sites.

visualize connections

Dual Scopes

Project KB (./kb/) and user KB (~/.memex/kb/) with shared search.

@project + @user

Static Publishing

Generate HTML with embedded search, tag pages, and graph visualization.

mx publish -o _site

Agent Integration

mx prime, mx schema, mx batch. Built for AI coding assistants.

claude, codex, openai

Install

With uv (recommended)
uv tool install memex-kb
With pip
pip install memex-kb

Requires Python 3.11+. Semantic search included; first run downloads ~90MB embedding model.

Quick Start

mx init                           # Create kb/ directory
mx add --title="API Notes" \     # Add an entry
       --tags="api,docs" \       
       --category=reference \    
       --content="Endpoint details..."

mx search "authentication"        # Hybrid search
mx get reference/api-notes.md     # Read an entry

Commands

Search & Browse

Command Description
mx search <query> Hybrid search (BM25 + semantic)
mx search --mode=semantic Semantic search only
mx get <path> Read an entry
mx list --tags=<tag> List entries by tag
mx tree Directory structure
mx whats-new Recent changes

Create & Edit

Command Description
mx add Create new entry with metadata
mx append Append to existing or create
mx patch Find/replace in an entry
mx ingest Import file into KB

Relations & Graph

Command Description
mx relations <path> Query entry relations
mx relations-add Add typed relation
mx relations-lint Check relation consistency
mx hubs Find high-connectivity entries
mx suggest-links Semantic link suggestions

Maintenance

Command Description
mx health Audit KB integrity
mx reindex Rebuild search indices
mx eval Search quality metrics
mx publish Generate static site

Agent Tools

Command Description
mx prime Session context for agents
mx schema --compact CLI schema (minimal tokens)
mx batch Multiple commands, one invocation

Entry Format

Entries are Markdown files with YAML frontmatter:

---
title: API Guide
tags: [api, docs]
description: Endpoints and auth
relations:
  - path: reference/auth.md
    type: documents
---

# API Guide

See [[reference/auth]] for auth details.

Relation types: depends_on, implements, extends, documents, references, blocks, related.

Philosophy

Design Principles
  • CLI-first: The command line is the primary interface. GUI is optional, CLI is mandatory.
  • Local-first: Your data stays on your machine. No cloud required, no network latency.
  • AI-friendly: Structured output, compact schemas, batch operations. Built for agents that read documentation.
  • Plain text: Markdown + YAML. No proprietary formats. Readable in any editor from now until forever.
  • Do one thing well: Knowledge management, not project management, not note-taking, not todo lists.
  • Substance over style: Fast, reliable, predictable. No surprises, no lock-in.