hive
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@hivecheck shared memory for the current project state and blockers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
hive ๐
A shared brain for Claude Code and its sub-agents (MCP server + CLI).
Agents share state, not conversations: a fresh agent boots with a ~350-token compiled working set instead of re-reading 30k tokens of files and transcripts. Decisions survive across sessions and days, sub-agents inherit each other's results (never their chat logs), and 50 parallel agents can write without clobbering each other.
Golden rule: never make an agent pay tokens to read information it doesn't need โ or pay twice for the same information.
Full design: docs/PLAN.md.
Install (global, like any CLI)
npm install -g hive-mcpOr from source:
git clone https://github.com/HusseinTaha/hive-mcp.git && cd hive-mcp
npm install && npm run build
npm install -g .Now hive works from anywhere. Data lives in one file: ~/.hive/ctx.db (an existing
~/.sharedctx/ctx.db from older versions is adopted automatically).
Related MCP server: LightRAG Code Brain MCP
Set up a project (once per repo)
cd your-project
hive initThis does three things:
.mcp.jsonโ registers thehiveMCP server, giving every agent five tools (below)..claude/settings.jsonโ wires three hooks:SessionStartโ injects a <800-token bootstrap, so every session starts already knowing the projectSubagentStopโ commits each sub-agent's final report to shared memory automaticallyPreCompactโ snapshots state before Claude Code compacts, so nothing is lost mid-session
CLAUDE.mdโ adds the one-line norm: bootstrap withctx_get, save results withctx_commit.
Restart Claude Code afterwards so it picks up the config.
Daily use
You mostly don't do anything โ that's the point. The hooks bootstrap every session and capture every sub-agent's results. Your part is telling Claude things worth remembering, in plain language:
"Commit to shared memory: we're using PostgreSQL because we need transactions."
"Save the decision that access tokens expire in 15 minutes."
"Check shared memory before proposing a database."
And when you come back tomorrow, a new session already knows all of it.
What agents get (the 5 MCP tools)
Tool | What it does |
| The working set: objective, current tasks, blockers, hot decisions, recent changes, topic index โ compiled to a budget (~350โ800 tok). Pass |
| BM25 search over everything ever stored, ~40 tok/hit with |
| Save results: what changed, decisions (key/value/reason), facts, open questions, task updates. Hard size caps โ a commit is a telegram, not a memoir. |
| Lease-based task board: |
| A bespoke context pack for one task description โ relevance-ranked, so cold facts matching the task resurface and hot-but-unrelated ones drop. |
What a bootstrap looks like
== acme-api @ a3f9c21 ยท CURSOR: 412 ==
OBJECTIVE: Ship v1 auth
NOW: refresh-token rotation (task#12, owner: backend-2)
BLOCKED: none
DECISIONS: db=PostgreSQL(relational+tx) | auth=JWT(15m access) | api=REST
CHANGED: login endpoint impl (backend-1, 2h ago, ev: tests/auth โ)
OPEN: rate-limit login?
โ VERIFY: 'api routes complete' written @ b2e11f0 (HEAD moved)
TOPICS: auth(9k) db(6k) api-contracts(7k)
MORE: d:cors ยท q:session-invalidation โ pull via topic= or ctx_search~350 tokens replacing a 30k-token history dump. Superseded decisions never appear here, but stay searchable forever โ that's what stops agent #7 from re-proposing MongoDB.
CLI reference
hive init wire up .mcp.json + hooks + CLAUDE.md in cwd, seed DB
hive status [--project P] [--role R] [--budget N] [--topic T] [--since N]
print the compiled working set (what agents see)
hive stats [--project P] context-spend telemetry per tool + est. savings
hive distill [--project P] heat decay + working-set pressure valve (also runs
automatically every ~25 events)
hive compress [--project P] [--model M] [--dry-run]
model-assisted fact compression via the claude CLI;
originals kept in supersede chains
hive dump [--project P] raw append-only event log as JSON lines
hive bootstrap alias of status (used by the SessionStart hook)Environment: HIVE_DB overrides the DB path; HIVE_PROJECT overrides the project key
(default: git-root basename). Legacy SHAREDCTX_* names still work.
Why it saves ~90%+ of context tokens
Naive shared-history | hive | |
Tool schemas | ~2,000 (10 verbose tools) | ~840 (5 terse tools, CI-guarded) |
Bootstrap | 20kโ80k transcript / file re-reads | ~350โ800 (hook-injected) |
Refresh checks | full re-dump each time | ~15โ100 (cursor deltas) |
Handoff | poisons the next agent | ~200-tok structured commit |
Under the hood: append-only SQLite event log (WAL โ 50 parallel writers, zero conflicts),
facts with supersede-chains (nothing is ever deleted), provenance + git-drift โ VERIFY
flags on volatile facts, evidence-gated completion, and a distiller that keeps the hot
working set โค ~1,500 tokens no matter how much knowledge accumulates.
Development
npm test # 39 tests: behavior, eval harness (50k-token seeded project),
# multi-process stress (20 writers / 12-way lease race), schema-token guard
npm run build # tsc โ dist/
npm install -g . # reinstall the global CLI after changesRoadmap M0โM4 from docs/PLAN.md is complete. Remaining work is field
tuning: use it on real projects and let hive stats + the eval harness drive ranking changes.
Available Tools
5 toolsctx_commitC
Save compact results before finishing; caps enforced.
| Name | Required | Description | Default |
|---|---|---|---|
| next | No | ||
| agent | Yes | ||
| facts | No | ||
| since | No | ||
| tasks | No | ||
| changed | Yes | ||
| project | No | ||
| evidence | No | ||
| decisions | No | ||
| questions | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. "Caps enforced" is a genuine hint that limits/truncation apply, but it is undefined โ no cap values, no behavior on overflow, no statement of whether prior context is replaced or merged, no auth requirements, and no idempotency info for a 10-parameter mutation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
At eight words it is front-loaded and wastes no filler, but this is under-specification masquerading as conciseness โ the brevity strips information an agent needs for a complex 10-parameter write rather than trimming redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Ten parameters, two required, zero schema descriptions, no annotations, no output schema, and an eight-word description leave the agent without enough to call this correctly or understand its effects. The definition is far too thin for the tool's complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across 10 parameters, and the description adds no parameter meaning whatsoever โ agent, changed, facts, tasks, decisions, questions, since, next, project, and evidence are all unexplained in both places. "Caps enforced" is the only tangential hint and is too vague to compensate for the coverage gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a verb ("Save") and a loose resource ("compact results"), so an agent can infer this persists something before ending a session. However, "compact results" is jargon that doesn't map cleanly to the schema's facts/tasks/decisions/questions structures, and nothing distinguishes it from ctx_task or ctx_compile beyond the vague write implication.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
"Before finishing" gives a real timing trigger, implying this is the terminal/persist step of a session. But no alternatives are named and there is no when-not guidance, so the sibling relationship with ctx_get/ctx_search/ctx_task/ctx_compile is left entirely to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ctx_compileD
Context pack for one task.
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | ||
| task | Yes | ||
| budget | No | ||
| project | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure, and it discloses nothing. It does not state whether the operation is read-only, whether the budget parameter caps output, what side effects exist, or what permissions are needed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single fragment is short but this is under-specification rather than effective conciseness. There is no front-loaded statement of action or outcome for the agent to anchor on.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a four-parameter tool with no annotations, no output schema, and no parameter descriptions, the definition leaves the agent with nothing to determine behavior or required inputs beyond the schema's field names. It is fundamentally incomplete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across four parameters (role, task, budget, project), and the description explains none of them. The agent cannot learn what 'budget' constrains or how 'role' affects the compiled pack.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description is a noun phrase ('Context pack for one task') rather than a verb+resource statement, so it does not say what the tool actually does (compile/build a context window). It gives no differentiation from siblings like ctx_get, ctx_search, or ctx_task.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use guidance, no exclusions, and no mention of alternatives. Nothing tells the agent when ctx_compile should be chosen over ctx_get, ctx_search, or ctx_task.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ctx_getB
Shared project context. Call at start; pass since= later for deltas. topic= drills in.
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | ||
| since | No | ||
| topic | No | ||
| budget | No | ||
| project | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations and no output schema, the description carries the full load, and it does disclose meaningful behavior: since returns deltas relative to a cursor and topic drills in. It says nothing about auth/permissions, result format, budget behavior, or whether the call is read-only, leaving real gaps for a context-fetch tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three telegraphic fragments, front-loaded with the resource and the when-to-call guidance; nothing is redundant. It borders on under-specification rather than excess, so it is tight but not wasteful.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 5-parameter tool with 0% schema coverage, no annotations, and no output schema, the description should explain role/budget/project and the return shape. It covers only since and topic, leaving the agent guessing on the majority of the surface.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across 5 parameters, so the description must compensate and only partially does: it explains since (cursor for deltas) and topic (drill in) but says nothing about role (an enum with 6 values), budget, or project. Three of five parameters are undocumented in both the schema and the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
"Shared project context" names the resource but supplies no verb, so the agent must infer that this is a read/retrieval call (the name ctx_get and "Call at start" hint at it). It does not differentiate this tool from siblings like ctx_search or ctx_compile, so it lands at minimum-viable rather than clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives concrete timing guidance ("Call at start") and conditional behavior ("pass since=<last CURSOR> later for deltas"), which tells the agent exactly when and how to re-invoke. It stops short of naming alternatives (ctx_search, ctx_commit) or stating when *not* to use it, so it is clear context without exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ctx_searchD
Search shared memory.
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| q | Yes | ||
| project | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden, yet it says only 'Search shared memory.' It does not disclose read-only vs mutating behavior, whether the search is keyword/semantic/hybrid, result limits, permissions, or what a match looks like. This is a severe gap for a search tool with zero structured safety hints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single sentence is short and front-loaded, but this is under-specification rather than conciseness. Nothing here would be cut for being redundant; instead, essential content is missing.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
A 3-param search tool with no annotations and no output schema demands a description that explains query semantics, scope, and result behavior. The description supplies none of that, so an agent cannot safely invoke it without inspecting sibling tools or guessing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description does not mention any of the three parameters (q, k, project). An agent cannot learn that q is the query string, k bounds result count, or project scopes the search. With the schema doing none of the work and the description doing none either, parameter semantics are effectively absent.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a verb (Search) and a resource (shared memory), so the basic intent is legible. However, it is generic and does not differentiate this tool from siblings like ctx_get, ctx_compile, or ctx_task, leaving the agent to guess the boundary. That is the definition of a vague-but-not-tautological purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus ctx_get or any other sibling, no mention of prerequisites, and no exclusions. The description offers nothing beyond the name.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ctx_taskC
Claim|release|complete a task; complete needs evidence.
| Name | Required | Description | Default |
|---|---|---|---|
| agent | Yes | ||
| action | Yes | ||
| project | No | ||
| task_id | Yes | ||
| evidence | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden, yet it says nothing about what claiming does (locking, exclusivity, conflicts), whether release undoes a claim, what recovery follows a failed complete, or any permission requirements. 'complete needs evidence' is the only real behavioral disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Extremely compact and front-loaded with the action verbs, so no sentence is wasted. However, at this level of compression for a 5-parameter mutating tool the terseness shades into under-specification.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
A concurrency-sensitive task-mutation tool with 5 params, zero schema descriptions, no annotations, and no output schema needs substantially more than 8 words. An agent cannot tell what a successful claim returns or how conflicts are surfaced.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across 5 parameters, so the description must compensate, and it only partially does. It implies the action enum values and flags evidence for complete, but says nothing about the required agent or task_id, nor about the optional project.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Names three specific verbs (claim, release, complete) against one resource (a task), which is enough to distinguish it from read-oriented siblings like ctx_get/ctx_search. The pipe-delimited form and lack of any scope statement keep it from a 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The only guidance is that 'complete' requires evidence, which is a precondition rather than a when-to-use statement. It never says when to claim vs. release, or how this relates to the mutation-flavored sibling ctx_commit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.1.3- First observed
ctx_commit - First observed
ctx_compile - First observed
ctx_get - First observed
ctx_search - First observed
ctx_task
TDQS
Scored across 5 tools
Most tools have clearly distinct purposes: get context, search memory, commit results, manage tasks, compile context pack. However, ctx_get and ctx_search both retrieve shared information, which could cause confusion for an agent unfamiliar with the system.
All tools share the 'ctx_' prefix and mostly follow a verb-noun pattern (get, search, commit, compile). The exception is ctx_task, which uses a noun instead of a verb, creating a minor inconsistency.
Five tools is well-scoped for a shared context and task management server. Each tool has a clear role and the set is neither too thin nor too heavy.
The surface covers retrieving context, searching, committing results, managing task states, and compiling context packs. However, there is no tool to create tasks, list tasks, or update/delete context, which are notable gaps for a collaborative context system.
Maintenance
Related MCP Connectors
Shared memory for coding agents. Stop re-explaining your codebase every session.
Persistent cross-session memory shared by Codex, Claude Code, ChatGPT, and other AI agents.
- vibsyncOAuthcom.vibsync
One shared brain for your AI coding agents: team memory, agent Q&A, tasks, and file claims.
Shared project memory that keeps teammates and AI agents aligned across sessions.
Related MCP Servers
- AlicenseAqualityAmaintenancePersistent shared memory for AI coding agents. Stores facts as entity/key/value triples with hybrid semantic search, task checkpoints, and conflict resolution โ shared across Claude Code, Codex CLI, and GitHub Copilot.16235 npm5AGPL 3.0
- AlicenseBqualityDmaintenanceProvides a durable memory layer for coding agents like Claude Code and Codex by indexing codebases and enabling RAG queries, reducing rediscovery tokens and providing senior-engineer orientation.23MIT
- AlicenseNot gradedqualityBmaintenancePersistent, shared memory for Claude across sessions and clients (Code, Desktop, Cowork) โ deterministic diff reads, checkpoints, cross-client task handoff, and project-wide search. 100% local and deterministic, no API keys, no LLM summarization.4MIT
- AlicenseAqualityBmaintenanceActs as a persistent memory and cross-tool shared context store, and builds a queryable codebase knowledge graph to slash token usage via structural answers.913 npm25MIT