convez.ai
MCP ServerDados & AnalyticsAvançado
ohdearquant

Khive — Runtime de Grafo de Conhecimento Estruturado

ohdearquant/khive

Grafo tipado com persistência para agentes que precisam de estrutura e memória

Ver no GitHub
BomPluginScore · de 0 a 100

MCP server em Rust que oferece um grafo de conhecimento tipado e persistente para agentes de IA. Combina busca híbrida (FTS5 + vetores), 63 operações semânticas organizadas em 7 domínios (KG, GTD, memória, comunicação, agenda) e armazenamento SQLite local. Diferencia-se ao priorizar estrutura explícita sobre vetores puros, permitindo que agentes raciocinem sobre linhagens, dependências e contradições.

Instalação

$npx convez-ai ohdearquant/khive

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
34
Forks
6
Acompanhando
0
Saúde
85%
Último commit
há 1 dia
Versão
v0.20.0
Issues abertas
421
Contribuidores
1

Casos de uso

  • Agentes de pesquisa que precisam rastrear entidades, relações e contradições entre documentos
  • Sistemas que mantêm contexto cross-session com histórico auditável (soft-delete + supersede)
  • Aplicações multi-tenant usando namespaces isolados em um único banco de dados

Veredito

Ferramenta madura e bem-arquitetada para quem precisa de grafos de conhecimento estruturados sem overhead operacional (Neo4j, SPARQL). A abordagem de substrato tipado + MCP é inteligente, mas exige familiaridade com ontologias e design de schemas. Recomendado para projetos de pesquisa, análise competitiva e sistemas de memória de agentes.

README

A tradução para o português deste README ainda está na fila.

khive

A research knowledge graph runtime. Typed substrates, closed taxonomies, and a verb-consolidated MCP surface — built for agents that need structure, not just vectors.

CI crates.io License: Apache 2.0

Vector search finds similar text. A knowledge graph finds structure — lineages, dependencies, contradictions, gaps. khive gives your research agent a typed, queryable graph that grows as it works: read a paper and entities + edges fall out; make a connection and it's traversable immediately; come back next session and the graph remembers what you built.

No Neo4j. No SPARQL endpoint to deploy. SQLite on disk, MCP over stdio, cargo test in 4 seconds.


What you get

CapabilityHow
63 verbs, 7 packsKG, GTD, memory, brain, comm, schedule, knowledge — all load by default
Typed entities9 closed kinds: concept, document, dataset, project, person, org, artifact, service, resource
Typed edges15 closed relations in 8 categories (structure, derivation, provenance, temporal, dependency, impl, lateral, annotation)
Typed notes5 closed kinds: observation, insight, question, decision, reference
Hybrid retrievalFTS5 + vector RRF with embedding rerank; shipped BM25, HNSW, Vamana, and fusion crates for pack-specific retrieval paths
Graph traversalBFS with depth/direction/relation filters, bidirectional shortest path
GQL + SPARQL queriesParse to SQL, run against the same SQLite backend
Salience-weighted notesNotes carry salience scores; search ranks by semantic relevance × salience
Cross-substrate linksNotes annotate entities (and vice versa) via the same edge system
Soft delete + supersedeHistory-preserving: old records stay, newer ones supersede via graph edges
Namespace isolationTenant scoping on every operation — share one DB, isolate many agents

The three substrates

Everything in khive is one of three things:

SubstrateWhat it isMutabilityExample
EntityA graph node with typed edgesMutable + soft-deleteLoRA (concept), arxiv:2106.09685 (document)
NoteA temporal observation about the worldMutable + soft-delete"FlashAttention gains scale with seq len, not batch"
EventAn audit log entryImmutablecreate(kind="entity", ...) was called at T

Entities are things. Notes are what you think about things. Events are what happened.


The MCP verb surface

One MCP tool: request (ADR-020 + ADR-027). Every verb is a parsed op inside it.

request(ops="verb(arg=value, arg=value)")              # single op
request(ops="[v1(...), v2(...), v3(...)]")             # parallel batch (max 100)
request(ops="[{\"tool\":\"v1\",\"args\":{...}}, ...]") # equivalent JSON form

All 7 packs load by default — 63 verbs out of the box:

PackPrefixVerbsWhat it does
kg(bare)11Entities, edges, notes, graph queries
gtdgtd.5Task lifecycle (inbox → next → active → done)
memorymemory.2Salience-weighted remember / decay-ranked recall
brainbrain.13Bayesian user profiles + feedback loop
commcomm.5Threaded messaging
scheduleschedule.4Reminders and scheduled verb execution
knowledgeknowledge.14Atom-based KB with embedding rerank search

create, list, search take kind=entity|note (or kind=edge for list). get, update, delete, merge are UUID-only — they auto-detect the record type.

Agents reach khive via MCP stdio — Python, TypeScript, Rust, or any MCP-compatible client. No language SDK to learn.


Architecture

┌──────────────────────────────────────────────────────────────┐
│  kkernel mcp      — stdio MCP server (the `kkernel` binary)   │
│  khived           — persistent daemon (ADR-049): warm runtime │
│                     auto-spawned on first request             │
│  1 tool: `request` (ADR-020 + ADR-027) — parses DSL,         │
│  dispatches each op through the VerbRegistry                 │
└──────────────────────────────────────────────────────────────┘
                            ↕ VerbRegistry dispatch
┌──────────────────────────────────────────────────────────────┐
│  khive-pack-kg         — KG vocabulary + 11 verb handlers    │
│  khive-pack-gtd        — task lifecycle (5 verbs)            │
│  khive-pack-memory     — salience + decay recall (2 verbs)   │
│  khive-pack-brain      — Bayesian profiles (13 verbs)        │
│  khive-pack-comm       — threaded messaging (5 verbs)        │
│  khive-pack-schedule   — reminders + scheduled ops (4 verbs) │
│  khive-pack-knowledge  — atom KB + embedding rerank (14 verbs)│
└──────────────────────────────────────────────────────────────┘
                            ↕ in-process
┌──────────────────────────────────────────────────────────────┐
│  khive-runtime, khive-request, khive-query, khive-db,        │
│  khive-storage, khive-score, khive-types                     │
└──────────────────────────────────────────────────────────────┘

Embedded SQLite storage with FTS5 trigram text search and sqlite-vec vector search. Retrieval ships in-process BM25, HNSW, Vamana, and fusion crates for hybrid and pack-specific search paths. One binary, one DB file, no external services to run.

The khived daemon (ADR-049) keeps the runtime warm between MCP sessions — embedding model stays loaded, SQLite connections stay open, pack registries stay initialized. It auto-spawns on first request and persists in the background, eliminating cold-start overhead on reconnect.

HTTP gateway, CLI, and visual frontend are planned for future releases.


Crates

CratePurpose
khive-typesDomain types, Pack trait, closed enums
khive-scoreDeterministic i64 fixed-point scoring
khive-storageTrait-only capability surface (zero implementations)
khive-dbSQLite backend: entity/note/edge tables, FTS5 TextSearch, current sqlite-vec VectorStore compatibility
khive-retrievalHybrid retrieval primitives
khive-fusionRRF, weighted, union, vector-only, and keyword-only fusion strategies
khive-bm25BM25 keyword index
khive-hnswHNSW vector index
khive-vamanaVamana ANN index used by knowledge search
khive-querySPARQL / GQL → SQL compiler
khive-runtimeService API + VerbRegistry + PackRuntime trait
khive-requestRequest DSL parser (function-call, JSON; pipe / LNDL planned). Transport-agnostic AST.
khive-pack-kgKG pack: vocabulary, verb handlers, kind validation
khive-pack-gtdGTD pack: task lifecycle over the notes substrate
khive-pack-memoryMemory pack: salience-weighted remember/recall with decay
khive-pack-brainBrain pack: Bayesian user profiles, feedback, resolution
khive-pack-commComm pack: threaded messaging with inbox
khive-pack-scheduleSchedule pack: reminders and scheduled verb execution
khive-pack-knowledgeKnowledge pack: atom-based KB with embedding rerank search
khive-mcpMCP server library — single request tool dispatching through the VerbRegistry (served by kkernel mcp)
kkernelThe single shipped binary — kkernel mcp serves MCP; admin subcommands (exec, reindex, db, …)

Dependency direction (storage stack): types → score → storage → db → query → runtime → packs → mcp. Side input: request → mcp (the DSL parser is consumed only at the MCP dispatch boundary; packs do not depend on it). Storage is trait-only; backends (SQLite today, Postgres tomorrow) implement the traits without touching consumers.


Quick start

1. Install:

npm install -g khive

2. Add to your MCP config (.mcp.json in your project, or ~/.claude/mcp.json for global):

{ "mcpServers": { "khive": { "command": "khive", "args": ["mcp"] } } }

That's it. All 7 packs load by default, a background daemon auto-spawns to keep the runtime warm, and Claude Code discovers the request tool with the full 63-verb catalog.

Alternative: install via Cargo

If you prefer Rust tooling or need to build from source:

cargo install kkernel                          # from crates.io — installs the `kkernel` binary
# or:
git clone https://github.com/ohdearquant/khive.git && cd khive
cd crates && cargo build --release -p kkernel

Then point your MCP config at the binary's mcp subcommand:

{ "mcpServers": { "khive": { "command": "kkernel", "args": ["mcp"] } } }

kkernel is the single shipped binary; kkernel mcp serves the MCP request surface. The npm package installs a thin khive (and a khive-mcp compatibility) shim that forwards to kkernel mcp — the Cargo path invokes kkernel directly.

Usage

The agent expresses verbs as DSL ops inside the single request tool:

request(ops="create(kind=\"entity\", entity_kind=\"concept\", name=\"LoRA\")")
request(ops="search(kind=\"entity\", query=\"parameter efficient fine-tuning\")")
request(ops="link(source_id=\"<uuid>\", target_id=\"<uuid>\", relation=\"variant_of\")")

# Batch multiple ops in one call:
request(ops="[create(...), create(...), link(...)]")

Claude Code plugin (skills + agent)

For guided research workflows, install the marketplace plugin:

/plugin marketplace add ohdearquant/khive
/plugin install kg

This adds 4 workflow skills and a researcher agent:

SkillWhat it does
/kg:digestIngest material into the graph — extract entities, link, verify
/kg:exploreDiscover what the graph knows — traverse, narrate, surface gaps
/kg:connectWire a new concept into existing knowledge — find relations
/kg:polishAudit and fix — orphans, low-degree nodes, duplicates

Configuration

khive mcp                                     # Default: ~/.khive/khive.db
khive mcp --db /path/to/my.db                # Custom DB path
khive mcp --db :memory:                       # Ephemeral (testing)
khive mcp --namespace my-project              # Default namespace (default: "local")
khive mcp --no-embed                          # Disable local embedding model
khive mcp --log debug                         # Log level (default: warn)

Environment variables: KHIVE_DB, KHIVE_NAMESPACE, KHIVE_NO_EMBED, KHIVE_LOG.

Development

cd crates && cargo test --workspace
make ci  # Full CI: fmt, clippy, test, build

Prerequisites: Rust 1.94+ (via rustup), Deno 2.x (for the TypeScript CLI layer — optional)

  • Node.js 20+ and pnpm (for frontend — optional)

Contributing

  • Feature branches + PRs. Never push directly to main.
  • make ci must pass (fmt, clippy, test, no-default-features check, release build).
  • Conventional commits: feat(types): add NoteKind taxonomy.
  • Schema/interface changes need a design doc — propose in the PR or as an issue.
  • See CLAUDE.md for the developer guide, AGENTS.md for agent usage.

Status

v0.2.3 — published on crates.io. 63 verbs across 7 packs, 9 entity kinds, 15 edge relations, daemon warm startup (ADR-049), knowledge search with embedding rerank, Bayesian brain profiles, threaded messaging, scheduled verb execution. Ready for use with Claude Code and any MCP-compatible agent.

License

Apache 2.0 — see LICENSE.

Ver o original no GitHub

Bom para

Relacionados