[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81864":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":11,"stars30d":15,"stars90d":12,"forks30d":12,"starsTrendScore":12,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":9,"pushedAt":9,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":12,"starSnapshotCount":12,"syncStatus":15,"lastSyncTime":25,"discoverSource":26},81864,"khive","ohdearquant\u002Fkhive","ohdearquant","graph based self-learning context layer for AI agents persistence and reasoning",null,"Rust",1,0,23,27,2,40.7,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:01:35","# khive\n\nA research knowledge graph runtime. Typed substrates, closed taxonomies, and a verb-consolidated\nMCP surface — built for agents that need structure, not just vectors.\n\n[![CI](https:\u002F\u002Fgithub.com\u002Fohdearquant\u002Fkhive\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fohdearquant\u002Fkhive\u002Factions\u002Fworkflows\u002Fci.yml)\n[![crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fkhive-mcp.svg)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fkhive-mcp)\n[![License: Apache 2.0](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache_2.0-blue.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FApache-2.0)\n\nVector search finds similar text. A knowledge graph finds _structure_ — lineages, dependencies,\ncontradictions, gaps. khive gives your research agent a typed, queryable graph that grows as it\nworks: read a paper and entities + edges fall out; make a connection and it's traversable\nimmediately; come back next session and the graph remembers what you built.\n\nNo Neo4j. No SPARQL endpoint to deploy. SQLite on disk, MCP over stdio, `cargo test` in 4 seconds.\n\n---\n\n## What you get\n\n| Capability                  | How                                                                                                |\n| --------------------------- | -------------------------------------------------------------------------------------------------- |\n| **Typed entities**          | 6 closed kinds: concept, document, dataset, project, person, org                                   |\n| **Typed edges**             | 13 closed relations in 6 categories (structure, derivation, dependency, impl, lateral, annotation) |\n| **Typed notes**             | 5 closed kinds: observation, insight, question, decision, reference                                |\n| **Hybrid search**           | FTS5 trigram (CJK-safe) + sqlite-vec embeddings + reciprocal rank fusion                           |\n| **Graph traversal**         | BFS with depth\u002Fdirection\u002Frelation filters, bidirectional shortest path                             |\n| **GQL + SPARQL queries**    | Parse to SQL, run against the same SQLite backend                                                  |\n| **Salience-weighted notes** | Notes carry salience scores; search ranks by semantic relevance × salience                         |\n| **Cross-substrate links**   | Notes annotate entities (and vice versa) via the same edge system                                  |\n| **Soft delete + supersede** | History-preserving: old records stay, newer ones supersede via graph edges                         |\n| **Namespace isolation**     | Tenant scoping on every operation — share one DB, isolate many agents                              |\n\n---\n\n## The three substrates\n\nEverything in khive is one of three things:\n\n| Substrate  | What it is                             | Mutability            | Example                                              |\n| ---------- | -------------------------------------- | --------------------- | ---------------------------------------------------- |\n| **Entity** | A graph node with typed edges          | Mutable + soft-delete | `LoRA` (concept), `arxiv:2106.09685` (document)      |\n| **Note**   | A temporal observation about the world | Mutable + soft-delete | \"FlashAttention gains scale with seq len, not batch\" |\n| **Event**  | An audit log entry                     | Immutable             | `create(kind=\"entity\", ...)` was called at T         |\n\nEntities are _things_. Notes are _what you think about things_. Events are _what happened_.\n\n---\n\n## The MCP verb surface\n\nOne MCP tool: `request` (ADR-020 + ADR-027). Every verb is a parsed op inside it.\n\n```\nrequest(ops=\"verb(arg=value, arg=value)\")              # single op\nrequest(ops=\"[v1(...), v2(...), v3(...)]\")             # parallel batch (max 100)\nrequest(ops=\"[{\\\"tool\\\":\\\"v1\\\",\\\"args\\\":{...}}, ...]\") # equivalent JSON form\n```\n\nDefault pack: **kg** (11 verbs — `create`, `get`, `list`, `update`, `delete`, `merge`, `search`,\n`link`, `neighbors`, `traverse`, `query`). Load the **gtd** pack alongside for task lifecycle\n(`KHIVE_PACKS=kg,gtd` or `--pack kg --pack gtd`) and get 5 more verbs: `gtd.assign`, `gtd.next`,\n`gtd.complete`, `gtd.tasks`, `gtd.transition`.\n\n`create`, `list`, `search` take `kind=entity|note` (or `kind=edge` for `list`).\n`get`, `update`, `delete`, `merge` are UUID-only — they auto-detect the record type.\n\nAgents reach khive via MCP stdio — Python, TypeScript, Rust, or any MCP-compatible client.\nNo language SDK to learn.\n\n---\n\n## Architecture\n\n```\n┌──────────────────────────────────────────────────────────────┐\n│  khive-mcp       — Rust binary (stdio MCP server)            │\n│  1 tool: `request` (ADR-020 + ADR-027) — parses DSL,         │\n│  dispatches each op through the VerbRegistry                 │\n└──────────────────────────────────────────────────────────────┘\n                            ↕ VerbRegistry dispatch\n┌──────────────────────────────────────────────────────────────┐\n│  khive-pack-kg   — KG vocabulary + 11 verb handlers          │\n│  khive-pack-gtd  — task lifecycle (5 verbs, optional)        │\n└──────────────────────────────────────────────────────────────┘\n                            ↕ in-process\n┌──────────────────────────────────────────────────────────────┐\n│  khive-runtime, khive-request, khive-query, khive-db,        │\n│  khive-storage, khive-score, khive-types                     │\n└──────────────────────────────────────────────────────────────┘\n```\n\nNative sqlite-vec for vector search, FTS5 trigram tokenization (CJK-safe), concurrent connection\npooling, memory-local graph traversal. One binary, one DB file, no services to run.\n\nHTTP gateway, CLI, and visual frontend are planned for future releases.\n\n---\n\n## Crates\n\n| Crate            | Purpose                                                                                |\n| ---------------- | -------------------------------------------------------------------------------------- |\n| `khive-types`    | Domain types, Pack trait, closed enums                                                 |\n| `khive-score`    | Deterministic i64 fixed-point scoring                                                  |\n| `khive-storage`  | Trait-only capability surface (zero implementations)                                   |\n| `khive-db`       | SQLite backend: sqlite-vec, FTS5, graph edges                                          |\n| `khive-query`    | SPARQL \u002F GQL → SQL compiler                                                            |\n| `khive-runtime`  | Service API + VerbRegistry + PackRuntime trait                                         |\n| `khive-request`  | Request DSL parser (function-call, JSON; pipe \u002F LNDL planned). Transport-agnostic AST. |\n| `khive-pack-kg`  | KG pack: vocabulary, verb handlers, kind validation                                    |\n| `khive-pack-gtd` | GTD pack: task lifecycle over the notes substrate (loaded via `KHIVE_PACKS`)           |\n| `khive-mcp`      | Stdio MCP binary — single `request` tool dispatching through the VerbRegistry          |\n\nDependency direction (storage stack): `types → score → storage → db → query → runtime → pack-kg \u002F pack-gtd → mcp`.\nSide input: `request → mcp` (the DSL parser is consumed only at the MCP dispatch boundary;\npacks do not depend on it).\nStorage is trait-only; backends (SQLite today, Postgres tomorrow) implement the traits without\ntouching consumers.\n\n---\n\n## Quick start\n\n### Install from crates.io\n\n```bash\ncargo install khive-mcp\n```\n\n### Or build from source\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fohdearquant\u002Fkhive.git && cd khive\ncd crates && cargo build --release -p khive-mcp\n# Binary at: crates\u002Ftarget\u002Frelease\u002Fkhive-mcp\n```\n\n### Configure for Claude Code\n\nAdd to your project's `.mcp.json` (or `~\u002F.claude\u002Fmcp.json` for global):\n\n```json\n{\n  \"mcpServers\": {\n    \"khive\": {\n      \"command\": \"khive-mcp\",\n      \"args\": []\n    }\n  }\n}\n```\n\nThat's it. Claude Code auto-discovers the single `request` tool (the verb catalog is rendered in\nits description); the agent expresses verbs as DSL ops:\n\n```text\nrequest(ops=\"create(kind=\\\"entity\\\", entity_kind=\\\"concept\\\", name=\\\"LoRA\\\", description=\\\"Low-Rank Adaptation\\\")\")\nrequest(ops=\"search(kind=\\\"entity\\\", query=\\\"parameter efficient fine-tuning\\\")\")\nrequest(ops=\"link(source_id=\\\"\u003Clora-uuid>\\\", target_id=\\\"\u003Cqlora-uuid>\\\", relation=\\\"variant_of\\\")\")\n\n# Or batched in one call:\nrequest(ops=\"[create(kind=\\\"entity\\\", entity_kind=\\\"concept\\\", name=\\\"A\\\"), create(kind=\\\"entity\\\", entity_kind=\\\"concept\\\", name=\\\"B\\\")]\")\n```\n\n### Claude Code plugin (skills + agent)\n\nFor guided research workflows, install the marketplace plugin:\n\n```\n\u002Fplugin marketplace add ohdearquant\u002Fkhive\n\u002Fplugin install kg\n```\n\nThis adds 4 workflow skills and a researcher agent:\n\n| Skill         | What it does                                                    |\n| ------------- | --------------------------------------------------------------- |\n| `\u002Fkg:digest`  | Ingest material into the graph — extract entities, link, verify |\n| `\u002Fkg:explore` | Discover what the graph knows — traverse, narrate, surface gaps |\n| `\u002Fkg:connect` | Wire a new concept into existing knowledge — find relations     |\n| `\u002Fkg:polish`  | Audit and fix — orphans, low-degree nodes, duplicates           |\n\n### Configuration options\n\n```bash\nkhive-mcp                                    # Default: ~\u002F.khive\u002Fkhive-graph.db\nkhive-mcp --db \u002Fpath\u002Fto\u002Fmy.db               # Custom DB path\nkhive-mcp --db :memory:                      # Ephemeral (testing)\nkhive-mcp --namespace my-project             # Default namespace (default: \"local\")\nkhive-mcp --no-embed                         # Disable local embedding model\nkhive-mcp --log debug                        # Log level (default: warn)\n```\n\nEnvironment variables: `KHIVE_DB`, `KHIVE_NAMESPACE`, `KHIVE_NO_EMBED`, `KHIVE_LOG`.\n\n### Run tests\n\n```bash\ncd crates && cargo test --workspace\nmake ci  # Full CI: fmt, clippy, test, build\n```\n\n### Prerequisites\n\n- Rust 1.94+ (via [rustup](https:\u002F\u002Frustup.rs))\n- Deno 2.x (for TypeScript layers — optional, not needed for MCP server)\n- Node.js 20+ and pnpm (for frontend — optional)\n\n---\n\n## Contributing\n\n- Feature branches + PRs. Never push directly to main.\n- `make ci` must pass (fmt, clippy, test, no-default-features check, release build).\n- Conventional commits: `feat(types): add NoteKind taxonomy`.\n- Schema\u002Finterface changes need a design doc — propose in the PR or as an issue.\n- See [CLAUDE.md](CLAUDE.md) for the developer guide, [AGENTS.md](AGENTS.md) for agent usage.\n\n---\n\n## Status\n\n**v0.1.2 — published on [crates.io](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fkhive-mcp).** 9 crates, one\n`request` MCP tool dispatching 11 KG verbs through a DSL, pack-based verb dispatch, hybrid\nsearch with local embeddings, GQL\u002FSPARQL queries. Ready for use with Claude Code and any\nMCP-compatible agent.\n\n## License\n\nApache 2.0 — see [LICENSE](LICENSE).\n","khive 是一个用于构建领域特定知识图谱的研究知识图谱运行时系统。它采用 Rust 语言编写，具有类型化的实体、边和注释，支持结构化查询和混合搜索（包括全文搜索和向量嵌入搜索）。khive 提供了闭合的分类法和动词整合的MCP表面，旨在为需要结构化数据而非单纯向量的智能体提供支持。其核心功能包括基于 SQLite 的持久化存储、快速的 CI\u002FCD 流程以及无需额外部署 Neo4j 或 SPARQL 端点即可使用的便捷性。此外，khive 还支持命名空间隔离，使得单个数据库可以服务于多个独立的研究代理。此项目适用于需要对研究资料进行深度分析并建立关联的知识密集型应用场景，如学术研究、企业知识管理等。","2026-06-11 04:06:59","CREATED_QUERY"]