HydraMind
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
🐉 HydraMind
Persistent memory for coding agents that knows when it may be wrong.
A graph-native MCP server that stores facts in HydraDB, tracks contradictions and revisions, propagates lost trust through provenance, and abstains instead of hallucinating.
Quickstart · Tools · How it works · Dashboard · Contributing · Roadmap
Table of contents
Related MCP server: MegaMemory
💡 Why HydraMind?
Agents forget between sessions. Worse, the memory tools that fix that tend to treat every stored sentence as equally true forever. When a fact changes, the old claim and everything concluded from it keep ranking just as high.
HydraMind treats uncertainty, revisions, and provenance as graph data:
Question | Plain vector store | HydraMind |
"What is similar to this text?" | ✅ | ✅ (transparent lexical score) |
"Which conclusions became less trustworthy when this fact changed?" | ❌ | ✅ |
"What did we believe on Tuesday, and why did it change?" | ❌ | ✅ |
"Show me the evidence behind this answer." | ❌ | ✅ native |
"I don't know." | Rarely | ✅ empty result below 0.80 evidence |
Recall combines a scoped graph match with a transparent text score. If there is no
evidence it returns [], so the agent can abstain instead of inventing an answer.
Built for Hack Hydra, Track 03: Memory + Context Retrieval and the Best Use of HydraDB prize. Judges can start with the Track 03 judge guide.
✨ Features
Eight MCP tools with typed schemas:
remember,recall,revise,timeline,trace_memory,check_conflict,explain_trust,forget.Sessionless MCP
2026-07-28over stdio, plus explicitly stateless Streamable HTTP.Trust that moves. Contradictions lower the older claim by
0.40, then lower its dependents for two hops by0.15 × hop, with a0.05floor.Explicit time.
reviseclosesvalid_to, writes a dated, reasonedSUPERSEDED_BYedge, and keeps the old fact auditable.Evidence traces through HydraDB's native
algo.SSpathsengine, with scope guards.First-class abstention. Insufficient keyword evidence returns
[], including tested domain-overlap hard negatives.Retry-safe writes. Idempotency keys repair interrupted writes without applying decay twice.
No embeddings, no hosted model calls, and no per-token bill on the retrieval path.
Live React dashboard on the same memory service. Every trust change you see is persisted in HydraDB.
Docker is not required anywhere.
Tested: unit, live Bolt, real MCP stdio, stateless HTTP, restart, and concurrency tests, plus a repeatable stress gate.
🚀 Quickstart
Prerequisites
Linux or macOS. Windows is not supported yet because local write coordination uses POSIX
fcntllocks (#29).Python 3.11+ and
uv(or plainpip).A source-built HydraDB
graph-nodelistening onneo4j://127.0.0.1:7687. See HydraDB's local server instructions.The auth token that
graph-nodereads fromGRAPH_AUTH_TOKEN_FILE.
HydraMind was checked against HydraDB commit
6a2fbb1
(August 13, 2026).
1. Install
git clone https://github.com/himanshu748/hydramind.git
cd hydramind
uv sync --extra dev --lockedpython3 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'2. Point it at HydraDB
export HYDRAMIND_TOKEN='local-development-token-32-bytes'
.venv/bin/python -c 'from hydramind.db import HydraDB; db = HydraDB(); db.verify_connection(); db.setup_schema(); print("HydraDB Bolt connection OK"); db.close()'All settings are listed in Configuration and
.env.example.
3. Run
Command | What it starts |
| MCP server over stdio. It waits silently for MCP messages; logs go to stderr. |
| Stateless Streamable HTTP MCP at |
| Landing page at |
| End-to-end terminal demo on an isolated graph. |
HydraMind uses the official MCP Python SDK v2 and negotiates the sessionless
2026-07-28 protocol, so requests never depend on a handshake or server-side session.
Every durable fact, relationship, and trust event lives in HydraDB. See the SDK's
MCP 2.0 changes.
🔌 Connect a coding agent
Codex CLI
codex mcp add hydramind \
--env HYDRAMIND_TOKEN=local-development-token-32-bytes \
--env HYDRAMIND_URI=neo4j://127.0.0.1:7687 \
-- /absolute/path/to/hydramind/.venv/bin/hydramindClaude Desktop, Cursor, and other JSON-configured hosts
{
"mcpServers": {
"hydramind": {
"command": "/absolute/path/to/hydramind/.venv/bin/hydramind",
"env": {
"HYDRAMIND_URI": "neo4j://127.0.0.1:7687",
"HYDRAMIND_USERNAME": "neo4j",
"HYDRAMIND_TOKEN": "local-development-token-32-bytes",
"HYDRAMIND_DATABASE": "default"
}
}
}
}Restart the host after editing. Outside local development, inject the token through the host's secret management instead of committing it to a config file.
HTTP clients: use http://127.0.0.1:8788/mcp. HydraMind forces JSON responses and
stateless_http=True, so a fresh client can recall data written by another client.
Bind to a non-loopback address only behind an authenticated gateway.
🧰 MCP tools
Tool | Behavior |
| Writes a trust-1.0 memory, |
| Filters in Cypher by scope and optional entity IDs, normalizes question words and light word variants, omits candidates below 0.80 keyword coverage, then ranks by trust × keyword overlap. |
| Replaces an active fact without erasing it. The old node becomes |
| An entity's current and superseded facts in chronological order, with validity bounds and revision links. |
| Calls HydraDB's native bounded single-source path engine and returns hydrated evidence paths. Paths containing an out-of-scope |
| Finds active memories about the same scoped entities and flags plausible opposite polarity, with a readable reason. |
| Walks |
| Sets status to |
Example session
remember("Production deploys must always use direct routing.", "acme", ["deploy-policy"])
remember("Checklist follows deploy policy.", "acme", ["checklist"], derived_from=[root_id])
remember("Production deploys must not use direct routing.", "acme", ["deploy-policy"])
recall("How should production route?", "acme", ["deploy-policy"])
revise(runtime_id, "Agents use Python 3.13.", "acme", reason="Toolchain upgraded")
timeline("acme", "agent-runtime")
trace_memory(root_id, "acme")The newest claim stays at trust 1.0, the older claim becomes contradicted at
0.6, and the dependent checklist loses 0.15. Both claims remain auditable.
🧠 How it works
flowchart LR
New["new memory<br/>trust 1.00"] -->|"CONTRADICTS<br/>time + reason + trust delta"| Old["older memory<br/>trust 0.60"]
Child["derived memory<br/>trust 0.85"] -->|DERIVED_FROM| Old
Grandchild["two-hop derivative<br/>trust 0.70"] -->|DERIVED_FROM| Child
Prior["Tuesday fact<br/>superseded"] -->|"SUPERSEDED_BY<br/>valid_to + reason"| Current["Wednesday fact<br/>active"]
New -->|ABOUT| Entity["Entity"]
Old -->|ABOUT| Entity
Prior -->|ABOUT| Entity
Current -->|ABOUT| EntityWrite.
rememberlinks the memory to scoped entities and optional parents.Detect. A small, replaceable polarity heuristic (
conflict.py) checks active same-entity memories before the write.Propagate. On contradiction, the older claim drops by
0.40, and incomingDERIVED_FROMdependents drop by0.15 × hopfor two hops. Each drop is stored as an immutableTRUST_DECAYevent.Recall. Candidates in scope are scored by
trust_score × keyword_overlap. Anything below 0.80 coverage is dropped, so an empty list means "no evidence".Explain.
explain_trustandtrace_memoryturn the graph back into plain language and evidence paths.
flowchart TB
Agent["Coding agent<br/>(Codex, Claude, Cursor, ...)"] -->|MCP stdio / stateless HTTP| Server["hydramind.server"]
Browser["Browser"] -->|JSON API| Web["hydramind.web<br/>+ React dashboard"]
Server --> Service["MemoryService<br/>hydramind.tools"]
Web --> Service
Service --> Conflict["conflict.py<br/>polarity heuristic"]
Service -->|official neo4j driver, Bolt| HydraDB[("HydraDB<br/>graph-node")]📊 Dashboard
The React interface ships prebuilt inside the repository and Python package, so it works right after install:
.venv/bin/hydramind-uihttp://127.0.0.1:8787/: landing page with an interactive trust cascade.
http://127.0.0.1:8787/app: live HydraDB dashboard to seed a demo graph, recall, remember, revise, inspect timelines, run native traces, explain trust, and forget.
The UI uses the same Python memory service as the MCP tools. To work on the UI itself, see UI development.
🎬 Demo and evaluation
With HydraDB running and HYDRAMIND_TOKEN set:
.venv/bin/python examples/demo.py # add --keep to retain the isolated graph
.venv/bin/python -m benchmarks.track03_evalThe demo creates an isolated graph, shows two-hop provenance, catches a revision before write, shows trust propagation and ranking, explains the old claim, proves abstention, and cleans up.
The six-case Track 03 evaluation covers cross-service continuity, explicit chronology,
missing-information abstention, contradiction decay, two-hop provenance decay, and
native evidence tracing. A raw passing run is checked in at
benchmarks/results/track03-evaluation.json.
It is a small reproducible smoke evaluation, not a LongMemEval result or a claim of
superiority over vector stores.
Show the
Memory/Entitygraph and the two-hopDERIVED_FROMchain.Insert an opposing production policy and show the persisted
CONTRADICTSedge.Show trust changing
1.0 → 0.6,1.0 → 0.85, and1.0 → 0.70.Revise the runtime fact and show the dated
SUPERSEDED_BYtimeline.Trace a memory through native
algo.SSpaths, then ask for absent information and get[].
🔧 Configuration
Variable | Default | Purpose |
|
| HydraDB Bolt URI |
|
| Bolt username |
| unset | Preferred auth token |
| unset | Fallback if |
|
| Graph/database name |
|
| Value stored in |
|
| Per-process write backpressure, from 1 to 64 |
|
| Stateless MCP HTTP bind address |
|
| Stateless MCP HTTP port |
|
| HTTP request body limit, capped at 4 MiB |
|
| Dashboard bind address |
|
| Dashboard port |
HydraMind reads these from the process environment. To load
.env.example after copying it to .env, run
set -a; . ./.env; set +a. Startup fails clearly when HydraDB or its token is
unavailable.
🗂 Data model
(:Memory {
id, content, source, created_at, valid_from, valid_to,
scope, trust_score, status, write_phase
})
(:Entity {id, name, kind, scope})
(:Memory)-[:ABOUT]->(:Entity)
(:Memory)-[:CONTRADICTS {detected_at, reason, before_trust, after_trust, apply_status}]->(:Memory)
(:Memory)-[:SUPERSEDED_BY {revised_at, reason}]->(:Memory)
(:Memory)-[:DERIVED_FROM {
last_decayed_at, last_decay_reason, before_trust, after_trust, decay_hop, caused_by
}]->(:Memory)
(:Memory)-[:TRUST_DECAY {
detected_at, reason, before_trust, after_trust, hop, caused_by, apply_status
}]->(:Memory)External memory IDs are strings, because JSON and JavaScript cannot safely represent every 63-bit integer. HydraDB stores them as non-negative integer vertex IDs.
Entity IDs are stable 63-bit hashes of scope plus name, so identical names cannot bridge scopes.
Each
TRUST_DECAYedge is an immutable event. The summary fields onDERIVED_FROMsupport quick inspection without overwriting history.HydraDB uses schema-on-write and does not support
CREATE CONSTRAINT, so startup creates a versionedHydraMindSchemamarker. Writes usesession.run(...)auto-commit statements because the current Bolt runtime has no explicit transactions. Queries stay within HydraDB's documented Cypher compatibility surface.
🧪 Testing and quality
.venv/bin/pytest -m 'not integration' # no database needed
HYDRAMIND_TOKEN=local-development-token-32-bytes .venv/bin/pytest # full live suite
.venv/bin/ruff check src tests examples
.venv/bin/ruff format --check src tests examples
.venv/bin/mypy srcThe live suite covers graph writes, scoped recall, entity filtering, ranking, abstention, contradiction and two-hop decay, trust explanations, revision chronology, scope-safe native tracing, non-destructive forgetting, real MCP stdio and stateless HTTP round trips, persistence across processes, concurrent and cross-process write races, idempotent retries with failures injected at five auto-commit boundaries, the dashboard HTTP handler, and the Track 03 evaluation.
Baseline (August 15, 2026): 48 tests (18 database-independent, 30 live), 91%
coverage of the MCP and HydraDB core. CI rebuilds the UI and checks it matches
ui/dist, then runs Ruff, mypy, the database-independent tests, and uv build.
Stress gate
HYDRAMIND_TOKEN=local-development-token-32-bytes \
.venv/bin/python benchmarks/product_stress.py \
--writes 250 --workers 8 --recall-probes 50 \
--output benchmarks/results/product-stress-250.jsonOn the pinned local HydraDB node this wrote 250/250 unique memories at 4.747
writes/s (2,910 ms write p95), verified 50/50 exact recall targets at 40.1 ms p50 and
41.4 ms p95, and recalled the target after a fresh-driver restart. The raw result is
at benchmarks/results/product-stress-250.json.
It measures durability and backpressure on one machine, not maximum throughput.
📁 Project layout
src/hydramind/
db.py HydraDB connection, Bolt errors, schema marker
conflict.py Replaceable conflict heuristic
tools.py Memory graph and the eight tool implementations
server.py MCP server v2 tools, sessionless stdio, stateless HTTP
web.py Local JSON API and landing/dashboard server
ui/src/ React + Vite + TypeScript dashboard (built output in ui/dist)
examples/ Terminal demo
benchmarks/ Track 03 evaluation, stress gate, checked-in results
tests/ Unit, live HydraDB, MCP transport, and web tests
design.md Design system for visual surfaces🧭 Limits and guarantees
These limits are deliberate and documented so you can tell what is guaranteed from what is future work.
Lexical, not semantic. Conflict detection and relevance use transparent keyword heuristics.
conflict.pyisolates the classifier so it can be replaced.Bounded graph work. Trust propagation stops at two hops. Traces stop at three hops and 100 paths. Recall returns at most 100 ranked results.
Recall scans the scope. Every eligible candidate in a scope is scored. Large deployments should partition scopes and benchmark latency.
Not crash-atomic. HydraDB's Bolt surface is auto-commit only. Local writers are coordinated, and keyed
rememberretries repair unfinished phases. Unkeyed writes and revisions are not distributed transactions.Scope is not auth. Scope partitions and guards queries. It is not authentication or tenant authorization. Put an authenticated gateway in front of any remote, multi-user deployment.
🗺 Roadmap
Ideas where contributions are especially welcome:
Pluggable semantic conflict classifier behind the
conflict.pyinterface (#9)Optional embedding-assisted recall that keeps the abstention guarantee (#11)
Indexed candidate selection for very large scopes (#14, #15)
Packaged releases on PyPI (#17)
Larger public benchmark runs, such as LongMemEval (#27)
Windows support (#29)
Browse all open issues. Have another idea? Open a feature request.
🤝 Contributing
Contributions of all sizes are welcome, from typo fixes to new retrieval strategies.
Start with CONTRIBUTING.md for setup, workflow, and coding
standards, and look for issues labelled
good first issue.
Everyone taking part is expected to follow the Code of Conduct. Notable changes are recorded in the changelog.
🔒 Security
Please do not open public issues for vulnerabilities. See SECURITY.md for private reporting.
🙏 Acknowledgements and license
HydraMind started as original Hack Hydra hackathon work. It builds on:
HydraDB: external AGPL-3.0 software accessed over Bolt, not vendored.
MCP Python SDK (MIT) and the Neo4j Python driver (Apache-2.0).
React, Vite, TypeScript, and Lucide for the UI. Bundled Inter, IBM Plex Mono, and Space Grotesk fonts use the SIL Open Font License.
Dependency versions and license metadata are in uv.lock and ui/package-lock.json.
HydraMind is released under the MIT License.
If HydraMind helps your agents remember responsibly, please ⭐ the repo.
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Provenance-carrying memory for AI agents: corrections supersede, never overwrite. Free, API + MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Hosted agent memory: store, search, and recall facts across sessions from any MCP client.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides a self-improving knowledge graph with per-triple provenance and deterministic reasoning, enabling auditable, reproducible, and contradiction-aware answers for AI agents.16,426 npmMIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that lets coding agents build and query a persistent knowledge graph of concepts, architecture, and decisions, enabling them to remember across sessions.307 npm729MIT
- AlicenseNot gradedqualityBmaintenanceSelf-hosted MCP server that gives coding agents persistent, code-aware memory with structural graph recall and blast-radius planning. It links experiential decisions to code locations and provides honest measurement instruments.Apache 2.0
- AlicenseAqualityAmaintenanceMCP server that gives coding agents persistent, verified memory of codebase decisions, conventions, and skills, with evidence-based claims that are re-checked via git hooks and human-gated review. Enables memory search, propose/approve, chat harvesting, and critique across MCP-compatible tools.21112 npm1MIT