HMG is a local-first memory kernel that gives coding agents branch-aware context, correction history, and governed recall across sessions.
curl -fsSL https://github.com/HMG-AI/HMG-public/releases/latest/download/install.sh | sh
hmg_brief_v2:
scope: "tenant/platform/HMG/main"
status: "public docs synced to v1.7.6"
decisions:
- "generated from export/docs"
- "coding-agent memory is the wedge"
risks: ["verify branch scope"]
next_steps: ["run drift checks"]
A reliability-focused release for real coding-agent sessions: stricter MCP behavior, agent-native extraction, and clearer recall output.
Spec-correct MCP ping, capability probes, and daemon-proxy fallback keep HMG usable when strict clients or store locks would otherwise interrupt a session.
DomainLens keeps software-engineering entities, relations, and recall views explicit, so branch, task, decision, and risk context survive between runs.
Recall marks the primary answer cluster separately from supporting same-scope context. Agents can act on the answer first and still audit the evidence.
Coding agents lose project decisions, branch assumptions, rejected approaches, and handoff notes between sessions. HMG turns that work history into governed recall.
Persist decisions, root causes, constraints, validation results, and next steps as typed graph atoms with scope and provenance.
Hybrid semantic + keyword retrieval and graph projection return context for the current workspace, repository, branch, and task.
Replace or demote wrong memories without erasing history. Future recalls prefer the canonical answer and retain lineage.
Quarantine, seal, tombstone, or derive safe lessons so ordinary recall stays useful without leaking governed payloads.
HMG is not a vector database wrapper. It combines typed memory atoms, branch-aware scope, correction lineage, governance state, and agent-readable output.
One MCP call returns current status, prior decisions, unresolved risks, next steps, and knowledge gaps for the next agent turn.
tenant → workspace → repository → branch. Memories stay isolated where they should, and merge-time context remains traceable.
Quarantine, seal, tombstone, and derive lessons with policy tags and audit context carried through the recall path.
Embedded storage, zero external dependencies. Data stays local, works offline.
Core memory, governance, MemoryQL, observation, vault, panorama, and graph-health workflows.
hmg-protocol (Apache-2.0) standalone crate defines types and serialization for all memory operations.
Install → automatic readiness → connect an agent
$ curl -fsSL https://github.com/HMG-AI/HMG-public/releases/latest/download/install.sh | sh
Installing HMG v1.7.8 for x86_64-unknown-linux-gnu...
HMG v1.7.8 installed, configured, and ready
$ hmg doctor
Core ready · store ready · daemon ready
$ hmg license status
Edition: Community (free)
Atoms: 100,000 limit | Used: 0
# Store a decision
$ curl -s -X POST http://127.0.0.1:7654/api/memorize \
-H 'Content-Type: application/json' \
-d '{"content": "Decision: use Rust for performance-critical paths"}'
# Recall
$ curl -s http://127.0.0.1:7654/api/recall \
-d '{"query": "what language did we choose?"}'
// Agent MCP config (e.g., in AGENTS.md or .cursor/mcp.json)
{
"mcpServers": {
"hmg": {
"command": "hmg",
"args": ["--mcp"]
}
}
}
// Agent tools become available:
// memory_memorize, memory_recall, memory_correct,
// memory_govern, memory_history, memory_handoff,
// memory_agent_brief, memory_stats
Single binary, runtime edition detection. No reinstall needed.
Each session writes usable context for the next. Decisions persist, corrections keep lineage, and governance defines what normal recall can see.
capture → canonicalize → recall → correct → govern → consolidate → brief next session
# Session 1: Store a decision
memory_memorize(content="Decision: use Rust for performance-critical paths")
# Session 2: Agent wakes up with full context
memory_agent_brief(domain_pack_id="software-engineering")
→ scope: tenant/platform/repo/main
→ decisions: "use Rust for perf paths"
→ risks: "WASM integration not yet validated"
→ next_steps: "benchmark Rust vs Go paths"
# Session 3: Correct stale knowledge
memory_correct(target_atom="01ABC...", action="replace",
new_content="Use Rust + WASM for cross-platform perf")
# Session 4: Govern sensitive data
memory_govern(target_atom="01DEF...", action="seal",
reason="contains internal API endpoint")
Four daily flows where HMG acts as memory infrastructure, not just retrieval.
Before editing code, the agent recalls prior decisions, constraints, risks, and next steps for the active scope.
memory_agent_brief(
domain_pack_id="software-engineering",
brief_format="compact_yaml",
language="en"
)
POST /api/agent-brief
Content-Type: application/json
{"domain_pack_id": "software-engineering",
"brief_format": "compact_yaml"}
hmg brief --domain software-engineering
hmg_brief_v2:
scope: "tenant/platform/repo/main"
engine: one_shot_recall
answer: |
Sprint 3 completed with RBAC v2.
Key decision: use Redis for session cache.
Rejected: JWT-only (no revocation).
sources:
- "01KSC7J75FVQHC5TCHGA1JQRWS"
related: []
gaps: []
validate_hint: "Query-directed recall"
Store decisions with rationale and rejected alternatives, so later sessions know both the choice and why it was made.
# Store a decision with rationale
memory_memorize(
content="Decision: use PostgreSQL 16 over MongoDB for ACID compliance",
source="ADR-014",
modality="text"
)
# Later: recall the decision and its context
memory_recall(query="Why did we choose PostgreSQL?")
→ "Decision: use PostgreSQL 16 over MongoDB for ACID compliance"
→ source: ADR-014
→ related: ["data integrity requirements", "transaction guarantees"]
When a memory becomes wrong or outdated, replace it while preserving the old version in correction history.
# Old (incorrect) memory:
"API runs on port 8080"
# Replace with correct value:
memory_correct(
target_atom="01PORT...",
action="replace",
new_content="API runs on port 7654",
reason="changed in config.rs v0.9.2"
)
# Subsequent recall returns:
memory_recall(query="what port does the API use?")
→ "API runs on port 7654" # canonical
memory_history(atom_id="01PORT...")
# Returns full lineage:
v1: "API runs on port 8080" # original
v2: "API runs on port 7654" # canonical ✓
correction_reason: "changed in config.rs"
correction_timestamp: 2026-05-29T...
superseded: v1 → v2
Seal, quarantine, tombstone, or derive lessons. Governed memories stay out of normal recall while audit can still explain what happened.
memory_govern(
target_atom="01SENS...",
action="derive_lesson",
reason="contains customer PII",
lesson_content="Customer data must be encrypted at rest (derived from incident 2026-05-28)"
)
# Normal recall: invisible
memory_recall(query="customer incident")
→ # (no governed results returned)
# Audit recall: lesson visible
memory_recall(query="customer incident", mode="audit")
→ "Customer data must be encrypted at rest"
Common issues and how to fix them.
hmg daemon stop && hmg daemon start --port 3001~/.local/share/hmg/ ownershiphmg doctor for diagnostics~/.local/share/hmg/stores/default/.lockhmg --mcp runs in terminalstartup_timeout_sec in MCP confighmg daemon statushmg license status shows active editionhmg license apply <key>hmg license status~/.local/share/hmg/stores/Run hmg doctor to check: edition, store path, daemon, MCP readiness, agent adapters, and disk usage.
$ hmg doctor
Edition: Community
Store: ~/.local/share/hmg/stores/default
Daemon: running on :7654
MCP: ready
Agents: pi, cursor
Disk: 12MB / 100K atom limit
✅ All checks passed
Official Python and TypeScript SDKs covering the full Community Edition API.
hmg-sdkpip install hmg-sdk
import hmg
client = hmg.HmgClient()
client.memorize("key decision: use Rust")
@hmg_ai/sdk-tsnpm install @hmg_ai/sdk-ts
import { HmgClient } from "@hmg_ai/sdk-ts";
const client = new HmgClient();
await client.memorize({content: "noted"});
Open protocol, open communication, open contributions.
hmg-protocol (Apache-2.0) defines types and serialization for memory atoms, corrections, governance, and scope.
Contributions welcome! Read CONTRIBUTING.md, submit a PR or Issue.
Found a vulnerability? Disclose privately via GitHub Security Advisories. 48-hour response commitment.