MIHAD
Summary: This MIHAD memory server lets a coding agent recall verified project memory, propose new items for verification, correct wrong ones, and report whether used items helped — so knowledge is adopted only with independent evidence.
Recall memory (
memory_recall) — Search persistent memory before starting work; pass aquerydescribing the task and optionallyk(default 5). Returns verified skills, facts and lessons pluspreferences(standing user working preferences you should follow). Items flagged provisional/unverified are hints only.Propose memory (
memory_propose) — Add something worth remembering, withkind:skill— reusable technique/pattern, verified by running existing project tests (verify.command,verify.test_files).fact— claim about the codebase, verified by quoting a project file (verify.file,verify.quote).preference— how the user wants future work done;verify.quotemust be the user's exact words.lesson— general lesson; stays provisional until a human approves it.Also supports
title,content,tags,supersedes(replaces an older item), andderived_from(item IDs it builds on).
Correct memory (
memory_correct) — Mark an item (byid) as wrong with areason; it and everything derived from it are suspended.Report outcomes (
memory_report_outcome) — At task end, reportsuccessand optionallytask_id,used_ids,helpful_ids,harmful_ids, andnotes, so the system learns which memory actually helped or caused problems.Overall — Only adopted items count as verified knowledge; verification is kind-specific (project tests, code quotes, or user's own words), keeping unproven conclusions out of the agent's memory.
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., "@MIHAD remember that I always want a regression test with every fix"
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.
💡 Why MIHAD
Coding agents start every session like a new hire on day one. They forget yesterday's corrections and repeat the same mistakes. Saving everything they "learn" is not the answer either: an agent that remembers its own wrong conclusions repeats them with confidence.
MIHAD gives an agent a memory and a body of experience that grow with use, and it adopts nothing without independent evidence. It is built on a research programme with pinned protocols, real repository history and a blind quality judge. Its measured gains are largest for cheaper models: with a strong model as the agent, success was the same with and without it (51/63 vs 50/63; on the sound tasks of that benchmark, 45/45 either way). See the paper.
Related MCP server: agentboost
✨ What it does
🛡️ Verified memory
A skill must pass your project's own tests. A fact must quote the code as it was before the session. A preference must be your own words. Everything else stays provisional, and corrections reach everything built on an item.
🗣️ Your preferences, kept
Say "Always add a regression test" once, in any message. It is captured verbatim, adopted, and followed in every later session. One-off instructions are never stored.
🧭 Brief, live warnings, review
At the start of each request the agent gets a short brief. While it works, known pitfalls are flagged the moment they recur. Before it finishes, its change is reviewed and executed: lines no test covers, lost formatting, broken preferences. Findings send it back to work.
🔁 Learns from your corrections
Every session is recorded. When you commit, your commit is the final version, and what you changed after the agent becomes experience. There is nothing extra to do.
🌙 Dreaming with A/B tests
Between sessions it practises on slightly broken copies of past fixes, with and without its lessons. A lesson is kept only if the test shows it helps.
🧩 Works where you work
OMP, Claude Code (terminal and desktop) and Codex. Ten programming languages. Standard-library Python with no dependencies. One command installs it into a project.
📊 What the experiments showed
Finding | Evidence | |
✅ | Captured preferences carried into every later task | 15/15 vs 0/15 without capture |
✅ | Wrong items planted in memory were never followed | Two contaminated-memory runs on real commits |
✅ | Operational experience transferred to new tasks | Same success (11/14), 14.4% fewer tokens, quality 3.93 vs 3.79 |
❌ | Knowledge about the code did not transfer | Same success, +16–17% cost (memory and notes) |
❌ | Generic advice in every session is noise | 10/14, more cost, lower quality: now off by default |
✅ | A conscience: a stronger model that speaks up after repeated mistakes | 44/63 vs 37/63, at ~37% of an always-on advisor's cost |
❌ | Generic property checks, contract ontology, rules learned from history | Precise but caught almost no failures on unseen repositories |
✅ | Executable review checks: facts about the change, not advice | 35/42 vs 32/42, 0 format regressions vs 10, +2% cost (3 repetitions) |
Exploratory results. The later experiments have 3 repetitions per arm and include repositories the designs had not seen; the earlier ones one run per cell. Methods and limits are in the paper.
🚀 Quick start
Requirements: Python 3.12+, git, and at least one of OMP, Claude Code or Codex.
1 · Install the tool
git clone https://github.com/abdullahbalabel/mihad.git
cd mihad
python -m pip install -e .2 · Add it to a project. Preview first, then install for your agent:
mihad-install D:/path/to/project --agent claude --dry-run
mihad-install D:/path/to/project --agent claude # or: --agent codex, --agent omp, or several3 · Work as usual. Open the project in your agent. To see what was learned and kept:
mihad report # lessons, verifier scripts, skills, competence, memory, dream cycles
mihad-memory list # what the memory holdsCodex loads a project's hooks only after you trust the project once in Codex. Claude Code needs no approval: the installer pre-approves the memory server for the project. See docs/AGENTS.md.
🤖 Agents
OMP | Claude Code | Codex | |
Verified memory (MCP) | ✅ | ✅ | ✅ |
Brief at each request | ✅ | ✅ | ✅ |
Live warnings after tools | ✅ | ✅ | ✅ |
Mandatory review before finishing | ✅ | ✅ | ✅ |
Learning from your commits | ✅ | ✅ | ✅ |
Dreaming with this agent | ✅ | ✅ | ✅ |
Wired through | extension | hooks | hooks |
Verification status for each check is in docs/AGENTS.md.
🧠 How it works
flowchart LR
U([You]) -->|request| A[Coding agent]
A -->|brief| B[(Memory and lessons)]
A -->|each tool result| D{Live detection}
D -->|warning| A
A -->|wants to finish| R{Review}
R -->|findings: one more turn| A
A -->|session log| E[Episodes]
U -->|your commit| E
E --> M[Mining: pitfalls, corrections, skills]
M --> V[Verifier scripts]
V --> P[Dreaming: practice with and without lessons]
P -->|A/B result| BEvery lesson has a gate before it is used:
Part | Kept only if |
Memory item | It passes the check for its kind: project tests, a quote from the starting commit, or your own words |
Failure-path lesson | Seen in two independent tasks, with a resolution that worked |
Co-change rule | Two independent tasks support it |
Verifier script | It fails before the fix and passes after it |
Skill | It succeeds on your final version of two past fixes |
Promotion | It wins an A/B test in practice without losing success |
Language | Function lookup | Test runners | Verified live |
Python | AST | pytest, unittest | ✅ |
JavaScript / TypeScript | Declaration scanner | node --test, Jest, Vitest, Mocha | ✅ |
Java / Kotlin | Declaration scanner | Maven, Gradle | analysis |
C# | Declaration scanner | dotnet test | analysis |
Go | Declaration scanner | go test | analysis |
Rust | Declaration scanner | cargo test | analysis |
PHP / Ruby | Declaration scanner | PHPUnit, RSpec, Minitest | analysis |
C / C++ | Declaration scanner | CTest, make test | analysis |
📚 Documentation
Guide | What's inside |
Requirements, install, uninstall, what is written where, safety | |
Daily workflow, commands, configuration, dreaming and its cost | |
OMP, Claude Code and Codex: setup, wiring, what has been verified | |
Every part, how it decides what to trust, and the evidence behind it | |
Modules, data files and the flow of a session | |
Findings at a glance, with links to the paper |
📄 Research
Better Coding Agents Without Retraining the Model: Verified Memory, Operational Experience and a Conscience. What Learns Is the System Around the Model, version 2.7 (Markdown · Word).
@techreport{balabel2026mihad,
author = {Balabel, Abdullah Mohammed},
title = {Adopting Reasoning Outputs Only After Verification: The {MIHAD} Architecture,
a Verified Memory and an Experience Engine for Coding Agents},
year = {2026},
month = {10},
note = {Version 2.1},
url = {https://github.com/abdullahbalabel/mihad}
}🌙 بالعربية
ذاكرة مهاد النمائية أداة تعطي وكيل البرمجة ذاكرة وخبرة تنموان مع الاستعمال، دون أن يتعلم أخطاءه ويكررها.
🛡️ ذاكرة لا تعتمد إلا ما له دليل مستقل: المهارة تُعتمد إن نجحت في اختبارات المشروع، والحقيقة إن اقتبست نص الكود كما كان قبل الجلسة، والتفضيل إن كان كلامك الحرفي.
🗣️ تفضيلاتك تُحفظ: تقولها مرة في أي رسالة، فتُلتقط بنصها وتُتبع في كل جلسة لاحقة.
🧭 موجز في بداية كل طلب، وتنبيه حي، ومراجعة إجبارية قبل الإنهاء: المراجعة تشغّل التغيير فعلًا، فتكشف الأسطر التي لا يغطيها أي اختبار، وضياع التنسيق، ومخالفة تفضيلاتك. إن وجدت مشكلة، يعود الوكيل للعمل.
🔁 يتعلم من تصحيحاتك: حين تعمل commit، تصبح نسختك هي النهائية، ويتعلم المحرك مما غيّرته بعد الوكيل.
🌙 الحلم: بين الجلسات يتدرب على نسخ معدلة من إصلاحات سابقة، بالدروس وبدونها، ولا يبقي درسًا إلا إن أثبتت التجربة فائدته.
🧩 يعمل مع OMP وClaude Code وCodex، وبعشر لغات برمجة، ويُثبَّت على أي مشروع بأمر واحد.
البحث الكامل في مجلد paper، والأدلة في مجلد docs.
⚖️ License
Copyright © 2026 Abdullah Mohammed Balabel.
Licensed under the PolyForm Noncommercial License 1.0.0. It is free for research, personal and other non-commercial use. Commercial use requires a separate licence from the author.
Available Tools
4 toolsmemory_correctB
Mark a memory item as wrong. It and everything derived from it is suspended.
Inputs: id (required), reason (required).
memory_proposeA
Propose something worth remembering for future sessions. kind=skill: a reusable technique or code pattern, verified by running existing project tests. kind=fact: a fact about this codebase, verified by quoting a project file. kind=preference: how the user wants work done in future sessions; verify.quote must be the user's exact words. kind=lesson: a general lesson; stays provisional until a human approves it. Only adopted items count as verified knowledge.
Inputs: kind (required), title (required), content (required), tags, +3 more.
memory_recallA
Search the project's persistent memory before starting work. Returns verified skills, facts and lessons from earlier sessions. Items marked provisional or unverified have NOT passed independent checks - treat them as hints only. 'preferences' are the user's standing working preferences: follow them.
Inputs: query (required), k.
memory_report_outcomeB
At the end of a task, report which memory items you used and whether they helped or caused problems.
Inputs: success (required), notes, task_id, used_ids, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct action on memory items: recall (read), propose (create), correct (invalidate), and report_outcome (feedback). Their purposes do not overlap, and the descriptions clearly delineate when to use each.
All tools follow a consistent memory_<verb> snake_case pattern: memory_recall, memory_propose, memory_correct, memory_report_outcome. The convention is predictable and readable.
Four tools is well-scoped for a persistent memory interface, covering the essential agent interactions without redundancy. Each tool earns its place in the memory lifecycle.
The set covers read, create, invalidate, and feedback, but lacks explicit update or delete operations. Agents can work around this by proposing new items and marking old ones as wrong, so the gap is minor.
Maintenance
Related MCP Connectors
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
The project brain for AI coding agents — memory, decisions, sprints, knowledge base via MCP.
Long-term memory for AI coding agents: durable project facts, recalled by every MCP client.
Hosted MCP memory for coding agents: persistent across sessions, editable markdown, team sharing.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides AI agents with a governed, three-layer project memory (guide, code facts, and knowledge) through namespaced MCP tools for code search, context compilation, impact analysis, and proposal-driven documentation updates.2MIT
- AlicenseNot gradedqualityCmaintenanceProvides coding agents with structured planning, persistent project memory, automated verification, and safety permission controls through MCP tools, enabling better planning, context retention, self-checking, and guarded execution.MIT
- AlicenseNot gradedqualityCmaintenanceProvides AI coding agents with deterministic, attestable org memory via an MCP server, enabling automatic recall of relevant facts on every prompt, loss-proof capture of learnings, and curated promotion of verified facts to a tenant-isolated memory store.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables teams of AI coding agents (Claude Code, Cursor, Codex) to share persistent, time-aware graph memory and coordinate their work via MCP, so agents recall verified fixes at the moment of failure, learn procedures automatically, avoid file conflicts, claim tasks race-free, and hand off facts and decisions between sessions.2MIT