Guide

How to use CruxHive

Setup, daily workflow, CLI and MCP tool reference — everything in one place.

Quick start

From zero to first knowledge entry in under 3 minutes.

1

Install the CLI

$ npm install -g @cruxhive/cli

Requires Node.js ≥ 18. Gives you the cruxhive command globally.

2

Init your project

$ cd my-project
$ cruxhive init

Creates .llm/ structure, installs cruxhive-mcp (Python server), wires your AI tools.

3

Index and verify

$ cruxhive index
$ cruxhive health

Builds the SQLite search index and confirms everything is wired correctly.

4

Reload your AI tool

Restart Claude Code, OpenCode, Cursor, or Windsurf. CruxHive context loads automatically. MCP tools are available immediately.

5

Propose and approve your first entry

$ cruxhive propose
$ cruxhive review

Interactive prompts guide you through creating and approving a knowledge entry. Approved entries are immediately searchable by every AI tool.

Requirements

DependencyRequired forInstall
Node.js ≥ 18CLI (cruxhive command)nodejs.org
@cruxhive/cliThe cruxhive CLI itselfnpm install -g @cruxhive/cli
Python ≥ 3.11MCP server + searchpython.org
uvFast Python install (recommended)curl -LsSf https://astral.sh/uv/install.sh | sh
gitVersion history, org syncgit-scm.com
sentence-transformersVector search (optional)pip install "cruxhive-mcp[full]"
fastapi + uvicornWeb UI (optional)pip install "cruxhive-mcp[ui]"

Setup steps

1. Install the CLI

$ npm install -g @cruxhive/cli

This gives you the cruxhive command. The Python MCP server (cruxhive-mcp) is installed automatically in the next step.

Want to install the Python server manually first (e.g. with extras)?

# Recommended (uv — zero dependency conflicts)

$ uv tool install cruxhive-mcp

# With optional extras

$ uv tool install "cruxhive-mcp[full]" # + hybrid vector search

$ uv tool install "cruxhive-mcp[ui]" # + web dashboard

2. Init a project

Run from your project root. CruxHive detects your AI tools automatically and wires itself in.

$ cd my-project

$ cruxhive init

✓ Created .llm/ .llm/plans/ .llm/memory/ .llm/context/

✓ Created .llm/CONTEXT.md

✓ Detected Claude Code → patched CLAUDE.md

✓ Detected OpenCode → AGENT.md symlinked

✓ Detected Cursor → .cursor/rules/cruxhive.mdc symlinked

✓ Registered cruxhive-mcp in .mcp.json

3. Edit CONTEXT.md

Open .llm/CONTEXT.md and fill in your project description, stack, and key conventions. This is the file every AI tool reads at the start of every session.

4. Index and verify

$ cruxhive index # builds .llm/cruxhive.db

$ cruxhive health # confirm everything is wired

5. Reload your AI tool

Restart Claude Code, OpenCode, Cursor, or Windsurf. The MCP server starts automatically. All CruxHive tools are now available in your AI sessions.

How it works

CruxHive has three moving parts:

  • .llm/CONTEXT.md — the canonical context file. Every AI tool reads this. It's a symlink target — CLAUDE.md, AGENT.md, .cursor/rules/cruxhive.mdc all point here. One file, zero drift.
  • .llm/cruxhive.db — SQLite knowledge base. Stores all indexed entries with FTS5 full-text search and optional vector embeddings for semantic search.
  • cruxhive-mcp — local MCP server. Exposes 11 tools that any MCP-compatible AI tool (Claude Code, OpenCode, Cursor, Windsurf) can call to search, propose, and review knowledge.

The core loop: AI proposes → human approves → knowledge persists → next session starts smarter. Nothing enters the shared base without a human sign-off. That's the quality gate that prevents AI hallucinations from accumulating over time.

Three-tier model

CruxHive organises context across three independent tiers, each with different access control and different consumers.

TierLocationContentsWho reads it
Personal ~/.cruxhive/personal/ Your coding preferences, shortcuts, style. Never shared. You only
Project .llm/ in the repo Plans, decisions, constraints, facts specific to this codebase. All contributors
Org Shared git remote Cross-project standards, architecture decisions, security rules. All org members

The org layer lives in a shared git remote. Configure it in cruxhive.config.yaml and run cruxhive sync to pull org context into any project.

Knowledge types

Every entry has a type field. Type determines how long it stays valid, how it's routed for approval, and how the health dashboard weighs it.

TypeWhat it capturesExpires?
factVerified truths — IPs, versions, URLs, API contracts90 days
decisionArchitectural choices with rationale + trade-off. Immutable unless superseded.365-day review
planSprint goals, upcoming work, phase intentionsOn completion
patternReusable solutions, code conventions the team repeats180-day review
constraintThings the team must NOT do and why. NLI-monitored for violations.Never
researchCompetitive intel, technology evaluations, external findings90 days
outcomeWhat happened — deploy results, experiment outcomes, post-mortemsNever

Frontmatter spec

Every .llm/ markdown file carries a YAML frontmatter block. CruxHive reads this to populate the search index and drive approval routing.

---

type: constraint # fact|decision|plan|pattern|constraint|research|outcome

scope: project # personal|project|org

topic: auth # 1-3 word tag

valid_at: 2026-05-27 # when this became true

invalid_at: ~ # null = still valid; set to deprecate

confidence: high # high|medium|low

source: human # human|ai-proposed|mozbridge-feed

approved_by: jessin # git username; ~ = pending

---

Never store JWT tokens in localStorage — XSS vulnerability.

Use httpOnly cookies or in-memory storage only.

Rules: source: ai-proposed entries are confidence-capped at medium until approved. invalid_at set means the entry is deprecated — it stays in git history but is excluded from search. supersedes: filename.md links replacements.

Daily workflow

WhenCommandWhy
Session opencontext_next_slice (auto via MCP)Find next unblocked work item
After commits/radarCheck all work maps to a plan
Something discoveredcruxhive proposeQueue it for approval
Weeklycruxhive healthStale entries, pending queue debt
Pending queue builds upcruxhive reviewApprove or reject entries
Approve visuallycruxhive uiWeb dashboard at localhost:3847

Proposing entries

There are three ways to propose a knowledge entry:

1. CLI (interactive)

$ cruxhive propose

# Prompts for type → topic → opens $EDITOR for content

2. MCP tool (from your AI session)

Ask your AI tool: "Propose a constraint: never use eval() in our codebase — XSS risk." It calls context_propose automatically.

3. Write directly

Create any .md file under .llm/pending/ with the correct frontmatter. Run cruxhive index to add it to the search index.

All proposals land with source: ai-proposed and approved_by: ~. They are searchable immediately but flagged as pending in cruxhive health.

Reviewing & approving

Proposals need a human to approve before they're treated as trusted knowledge (confidence: high, source: human).

Terminal (recommended)

$ cruxhive review

» [constraint] auth — never store JWT in localStorage

> Never store JWT tokens in localStorage — XSS risk…

[a]pprove / [r]eject / [s]kip: a

Your name: jessin

✓ Approved

Web dashboard

$ cruxhive ui # opens localhost:3847

# Requires: pip install "cruxhive-mcp[ui]"

MCP tools (from your AI session)

Call context_review to list pending, then context_approve or context_reject with the file path.

Slash commands (cross-tool)

cruxhive init writes six slash commands into both .claude/commands/ (Claude Code) and .opencode/commands/ (OpenCode). Same command name, same behaviour, same MCP tool under the hood.

SlashWhat it doesCalls
/radar [days]Scan recent commits, map to plan areas, surface work with no plancontext_radar
/next-slice [area]Find first unblocked work item from active plancontext_next_slice
/reviewList CruxHive proposals awaiting approvalcontext_review
/proposeInteractive: capture a new knowledge entrycontext_propose
/write-planDraft a new plan file under .llm/plans/context_write_plan
/extractDistill the current session into candidate entries — dedup, classify, queue for reviewcontext_search + context_propose

/extract is the auto-capture loop with the approval gate intact: the AI proposes, you approve. Run it at the end of a long conversation to surface durable facts before they're lost.

Cursor and Windsurf don't have a slash command system, but the same MCP tools are reachable via natural language ("run radar", "what's the next slice for auth?") — they'll route to the right tool.

Examples

# Same syntax works in Claude Code and OpenCode:

/radar # last 7 days

/radar 30 # last 30 days

/next-slice # first unchecked item

/next-slice auth # filter to area

# From any MCP-aware tool (Cursor, Windsurf, scripts):

context_radar(days=7)

context_next_slice(area="cicd")

Weekly health check

$ cruxhive health

→ Shows: entry counts · pending approvals · stale files · MCP status

Observability — measure what CruxHive is doing for you

Every MCP tool call is logged locally to .llm/cruxhive.db. No data leaves your machine. Disable with CRUXHIVE_ANALYTICS=0.

What gets logged

  • Every call to context_search, context_propose, context_approve, context_reject, context_review, context_index, context_check_faithfulness
  • Which AI tool called it (detected via env vars — Claude Code, Cursor, OpenCode, Windsurf)
  • The search query (truncated to 500 chars), result count, and latency
  • Faithfulness check violations (when cruxhive-mcp[full] is installed)

Terminal dashboard

$ cruxhive stats

→ Activity summary, by-AI-tool breakdown, top gaps, daily sparkline

$ cruxhive stats --days 30 --gaps

→ Custom window with zero-result query list

$ cruxhive stats --export csv > usage.csv

→ Raw event log for spreadsheet analysis

Web dashboard

cruxhive ui opens four tabs at localhost:3847:

TabWhat it shows
ApprovalsPending AI-proposed entries with approve/reject buttons
UsageKPIs (calls · searches · hit rate · proposals · pending queue), daily sparkline
By AI ToolPer-tool table: which model searches more, finds more, proposes more
Gaps & StalenessZero-result queries (= what to document next), entries older than 60 days

What decisions this enables

  • Which AI model to use: compare hit rate and proposal approval rate per tool
  • What to document next: zero-result queries are your backlog
  • When to audit: stale entries list flags knowledge that may give confidently-wrong answers
  • Whether the governance loop is healthy: pending queue age > 14 days = review is the bottleneck

CLI commands

CommandWhat it does
cruxhive initBootstrap .llm/, install MCP server, wire AI tools, create CONTEXT.md
cruxhive indexScan .llm/ and (re)build the SQLite knowledge index
cruxhive proposeInteractive: type → topic → editor → writes to .llm/pending/
cruxhive reviewTerminal loop: approve or reject each pending entry
cruxhive healthKnowledge base audit — pending count, stale files, MCP status
cruxhive statsObservability — searches/day, hit rate, zero-result gaps, per-AI-tool comparison. Use --days N, --gaps, --stale, --export csv, --clear
cruxhive syncPull org-layer context from the configured org_remote
cruxhive uiStart web dashboard at localhost:3847 — Approvals + Usage + By AI Tool + Gaps tabs (requires [ui] extra)

MCP tools

Available in any MCP-compatible AI tool (Claude Code, OpenCode, Cursor, Windsurf). Call them by name or ask your AI to use them.

ToolWhat it doesRead-only?
context_indexIndex or re-index all .llm/ markdown filesNo (idempotent)
context_searchHybrid BM25 + vector search over the knowledge baseYes
context_proposeWrite a pending entry to .llm/pending/ with source: ai-proposedNo
context_reviewList all pending entries awaiting approvalYes
context_approveApprove a pending entry — sets source: human on diskNo
context_rejectReject a pending entry — sets invalid_at, removes from indexNo
context_check_faithfulnessNLI check: does this AI response contradict any approved constraint?Yes
context_radarScan recent git commits → classify by plan area → coverage reportYes
context_next_sliceFind next unblocked item from active planYes
context_write_planWrite a plan file to .llm/plans/ and register in active.mdNo
context_sync_memoryRun the workspace sync script to pull org-layer contextNo (idempotent)

AI tool support

ToolContext fileMCP toolsAuto-sync
Claude Code CLAUDE.md.llm/CONTEXT.md ✓ via .mcp.json ✓ SessionStart hook
OpenCode AGENT.md.llm/CONTEXT.md ✓ via opencode.jsonc ✓ session.created plugin
Cursor .cursor/rules/cruxhive.mdc.llm/CONTEXT.md via .cursor/mcp.json Manual
Windsurf .windsurfRules.llm/CONTEXT.md partial Manual
Gemini CLI GEMINI.md.llm/CONTEXT.md Not yet Manual
VS Code Copilot .github/copilot-instructions.md via MCP config Manual

All tools load from the same .llm/CONTEXT.md via symlinks — one file, zero drift. Run bootstrap.sh (from ai-toolkit/) to wire all detected tools at once.

Troubleshooting

MCP tools not appearing in Claude Code

Check .mcp.json in your project root has a cruxhive entry. Restart Claude Code after editing. Verify cruxhive-mcp is on your PATH: which cruxhive-mcp.

context_search returns no results

Run cruxhive index first. The SQLite database (.llm/cruxhive.db) must be built before search works. It's not created automatically on install.

cruxhive-mcp not found

$ uv tool install cruxhive-mcp

# or: pip install cruxhive-mcp

# then add ~/.local/bin to PATH if needed

cruxhive ui fails to start

The web UI requires the [ui] extra: pip install "cruxhive-mcp[ui]". This installs FastAPI and uvicorn.

Vector search not working

Install the [full] extra: pip install "cruxhive-mcp[full]". The first run downloads ~270 MB of model weights (cached in ~/.cache/huggingface/). Then run cruxhive index to build vectors.

CONTEXT.md not loading in Cursor

Verify the symlink: ls -la .cursor/rules/cruxhive.mdc. It should point to ../../.llm/CONTEXT.md. Re-run bootstrap.sh if missing.