agent-memory-hub
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 8 GitHub stars
Code Gecti
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Git for Agent Memory — local-first, human-auditable memory & context governance across Codex, Claude Code, Antigravity, Gemini CLI, and any MCP client.
Agent Memory Hub
English | 简体中文
Git for Agent Memory — a local-first, human-auditable memory and context governance layer shared across Codex, Claude Code, Antigravity, Gemini CLI, and any MCP client.
One canonical memory vault you own in Markdown + Git, queried by every coding agent over MCP — instead of each tool locking your decisions and pitfalls inside a siloed black box.
Agent-native memory = L1 cache (disposable, vendor-local)
Agent Memory Hub = source of truth (Markdown + Git — diffable, revertable)
MCP = universal bridge (15 tools · stdio NDJSON + Content-Length)
SQLite FTS5 = derived index (rebuildable anytime; never source of truth)
30-Second Walkthrough

Architecture & Trust Boundaries
Status: v0.2.0 — Multi-agent MCP hub (Codex, Claude Code, Antigravity global plugin, Gemini CLI, plus public-only ChatGPT / Gemini Web isolation), cross-platform
SecretBackend(macOS Keychain, Linuxlibsecret, 1Password CLI, explicitisolated-env), governed write & Constrained Auto-Approve loop, Dreaming offline consolidation, Telegram / Feishu / WeChat ClawBot capture gateways, and macOS + Linux CI.
Honest boundary: Synthetic and holdout benchmarks measure candidate recall and policy isolation; end-to-end real-world production task quality still requires live evaluation. See public distribution checks.
Why Agent Memory Hub?
- You own the source of truth. Plain Markdown in Git — human-readable, diffable, revertable, and portable across models and editors.
- One memory across every agent. Built-in policies, startup sync, and exports for Codex, Claude Code, Antigravity (IDE / App /
agyCLI), and Gemini CLI, plus strict public-only sandboxing for ChatGPT and Gemini App/Web. - Governance before cleverness. Agents propose; humans approve. Untrusted web captures and session transcripts stay isolated in Zone B and can never auto-promote into canonical rules.
- Zero plaintext credentials. Secrets live in your OS or team secret manager (
macos-keychain,linux-libsecret,1password-cli, or explicitisolated-env), never inside the Git vault. - Zero external Python dependencies. The core MCP server, CLI, SQLite FTS5 indexer, policy engine, and secret scanner run on Python's standard library alone.
Supported Agents & Access Policies
Enforced at runtime by policies/agent-permissions.yaml (fail-closed):
| Agent | Role | Scopes | Max Sensitivity | Write Mode | Remote Dreaming | Startup / Integration |
|---|---|---|---|---|---|---|
Codex (codex) |
Daily coding agent | global, project, repo |
local-private (reference_only) |
proposal_only |
true (opt-in) |
exports/codex/AGENTS.md + startup sync |
Claude Code (claude_code) |
Daily coding agent | global, project, repo |
local-private (reference_only) |
proposal_only |
false |
exports/claude/CLAUDE.md + CLAUDE.md |
Antigravity (antigravity, agy) |
Daily agentic IDE / App / CLI | global, project, repo |
local-private (reference_only) |
proposal_only |
false |
startup plugin-sync (~/.gemini/config/plugins/agent-memory/) |
Gemini CLI (gemini_cli) |
Daily terminal coding agent | global, project, repo |
local-private (reference_only) |
proposal_only |
false |
startup sync --agent gemini + startup gemini-mcp-sync |
ChatGPT (chatgpt) |
Low-privilege research chat | global |
public (deny above) |
none (refused) |
true |
None by default |
Gemini App/Web (gemini) |
Low-privilege multimodal chat | global |
public (deny above) |
none (refused) |
true |
None by default |
| Hermes / OpenClaw | Candidate automation agents | global, project |
local-private (reference_only) |
proposal_only / import_as_source |
false |
exports/{hermes,openclaw}/ + WeChat ClawBot plugin |
Security Model (Reconciled & Audited)
1. Write Governance & Constrained Auto-Approve (4-Gate Physical Boundary)
Over MCP, agents cannot approve or edit wiki/ directly — there is no approve MCP tool. All agent-discovered memories go through memory.propose_write into inbox/proposals/ (status: proposed, excluded from active context_pack recall).
Promotion into wiki/ happens only through the CLI (bin/agent-memory-cli proposals approve <id>). There are two explicit modes, both keeping a human physical gate:
- Manual Human Approval (default): You run
agent-memory-cli proposals approve <id>directly (approved_by: user). - Constrained Auto-Approve (opt-in convenience for daily coding agents): An agent may invoke
agent-memory-cli proposals approve <id> --by <agent>:autoonly when all four conditions hold:- Same-session self-proposed ID: The proposal was created by this agent earlier in the current session (never a historical, background, or Dreaming ID).
- Explicit approval word: You reply with an unambiguous confirmation for that specific candidate (vague praise or uncertainty does not count).
- Audit echo: The agent prints
title + idbefore invoking the CLI, and stampsapproved_by: <agent>:autoin the promoted Markdown frontmatter so human vs. agent-initiated approvals remain distinguishable in Git history. - Retained harness physical gate: The agent's terminal confirmation prompt (Claude Code Bash prompt / Codex, Gemini CLI, or Antigravity per-command approval) must remain enabled and never be allowlisted — that single click is the physical stopgap against prompt injection or misread intent.
If any condition is unmet, the workflow falls back strictly to manual CLI approval. See AGENTS.md and docs/security-hardening.md.
2. Why secrets/ Exists — Reference Pointers Only, Zero Plaintext
The repository contains a secrets/ directory, which intentionally stores only non-secret reference metadata:
secrets/refs.yaml— maps logical IDs (e.g.,telegram_bot_token,dreaming_api_key) to external backend pointers (provider,service,account, rotation cadence,migration_policy). Zero secret values.secrets/devices.yaml— public device metadata template.
This guarantee is enforced automatically:
scripts/secret_scan.pyscans every tracked file in CI, every commit inpre-commit, and every indexed/proposed body inbin/agent-memory-mcp(sensitivity: secretexcludes a body from SQLite/FTS but never permits committing a real secret).scripts/phase1_5_secrets_check.rbverifiesrefs.yamlcontains zero secret values and that.agemigration bundles are blocked and gitignored.
Cross-Platform SecretBackend (scripts/secret_backend.py)
No longer macOS-only. Every secret lookup routes through a fail-closed SecretBackend abstraction (zero silent fallback to ambient environment variables):
| Provider | Platforms | Underlying Tool / Mechanism | Usage |
|---|---|---|---|
macos-keychain |
macOS | security(1) generic password |
Default when provider: auto on macOS |
linux-libsecret |
Linux | secret-tool(1) (GNOME Keyring / KWallet) |
Default when provider: auto on Linux |
1password-cli |
macOS / Linux / Windows | op read (op://vault/service/account) |
Cross-device sync; supports op_ref / op_vault |
isolated-env |
Linux / Windows / CI | Namespaced AGENT_MEMORY_SECRET_* |
Explicit opt-in only (requires AGENT_MEMORY_ALLOW_ENV_SECRETS=1) |
Override the active backend per machine or CI runner without editing refs.yaml:
export AGENT_MEMORY_SECRET_BACKEND="linux-libsecret" # or 1password-cli / isolated-env / macos-keychain
bin/agent-memory-cli secrets check
See docs/secret-manager-recipes.md.
3. Dreaming Explained — Governed Offline Memory Consolidation
Dreaming is an offline, read-only memory consolidation workflow that compares explicitly imported session evidence against existing project memories and produces reviewable create, supersede, merge, or retract drafts — never writing to wiki/ automatically.
- Explicit evidence only: No background transcript harvester. Sessions are explicitly imported as normalized JSONL (
episodes import) with SHA-256 hashes and secret/URL scanning. - Strict remote boundary: Remote analysis (
memory.dream_next/read/refine/submit) requires explicitcloud_processing: trueon the agent policy and releases onlypublic/project-publicinputs (bounded ≤ 96 KB). Optional API or loopback local-model backends are configured viapolicies/inference.yaml. - Atomic recovery: Approved corrections run under
vault_lockwith target file-hash verification and a rollback journal (inbox/transactions/).
See docs/local-memory-upgrade.md.
All 15 MCP Tools
bin/agent-memory-mcp serve exposes 15 tools over stdio (newline-delimited JSON by default, with LSP Content-Length auto-detection):
| Category | MCP Tools | Governance / Behavior |
|---|---|---|
| Recall (Read-Only) | memory.context_pack, memory.search, memory.get, memory.answer |
Policy-filtered by agent/scope/sensitivity; context_pack is active-only with 9 task-type budget templates & staleness tags |
| Navigation & Evidence | memory.navigation, memory.episodes_search, memory.episodes_get |
Derived topic index (repo_agents_md policy); explicit project-scoped session evidence (untrusted data, never instructions) |
| Governed Write | memory.propose_write |
Writes status: proposed to inbox/proposals/ only; blocks secrets & write_mode: none agents |
| Zone B Capture | memory.capture_link, memory.capture_text, memory.process_captures |
SSRF-guarded HTML/WeChat fetch → Markdown in sources/ + review node in inbox/needs-review/; never auto-promotes |
| Dreaming (Draft-Only) | memory.dream_next, memory.dream_read, memory.dream_refine, memory.dream_submit |
Paginated read-only snapshot, 1× query-expansion refinement, schema/hash-validated drafts in reports/dreams/ |
Reproducible Benchmarks & Validation
All recall and safety checks run locally in isolated temporary vaults with zero personal data:
| Benchmark / Suite | Baseline | Current | Safety / Isolation Result | Repro Command |
|---|---|---|---|---|
60-Case Synthetic Review Recall (@10, 12 distractors) |
2/40 (5.0% old FTS) |
27/40 (67.5% text) / 36/40 (90.0% scoped) |
8/8 disjoint versions · 0/6 cross-project leaks · 0/6 false conflicts |
python3 scripts/evaluate_memory_review.py |
24-Case SHA-256 Holdout Recall (@10, +6 near controls) |
11/24 (45.8% lexical) |
22/24 (91.7% with 1× dream_refine) |
0 cross-project leaks · 0 restricted-body leaks |
python3 scripts/evaluate_memory_review_holdout.py |
| End-to-End & Security Matrix | — | 7 Ruby suites + 108+ Python tests + Node hook tests | Dual secret scan, SSRF guard, fail-closed policy, rollback recovery | python3 scripts/validate_upgrade.py --portable |
Full acceptance reports: docs/memory-review-acceptance.md and docs/memory-review-followup-acceptance.md.
Quickstart
# 1. Build the derived SQLite FTS5 index
bin/agent-memory-mcp index
# 2. Check environment & print MCP registration snippets for all 4 coding agents
scripts/doctor.sh
# 3. Recall a task-scoped context pack (works with codex, claude_code, antigravity, gemini_cli)
bin/agent-memory-mcp context-pack --task "debug fixture timeout" \
--cwd "/work/example-project" --agent antigravity
# 4. Propose a durable learning (agent) → review & approve (human)
bin/agent-memory-mcp propose-write --title "Use loopback hostname in HTTP fixtures" \
--type pitfall --body "Avoid reverse DNS lookups in local test servers." \
--project example-project --agent gemini_cli
bin/agent-memory-cli proposals list
bin/agent-memory-cli proposals approve <proposal_id>
One-Command Client Wiring
# Antigravity (IDE / App / agy CLI) — installs global plugin bundle (MCP + rules + skill + PreInvocation auto-recall hook)
bin/agent-memory-cli startup plugin-sync
# Gemini CLI — syncs managed section in ~/.gemini/GEMINI.md & merges ~/.gemini/settings.json
bin/agent-memory-cli startup sync --agent gemini
bin/agent-memory-cli startup gemini-mcp-sync
# Codex — syncs managed section in ~/.codex/AGENTS.md (preserves all other user rules)
bin/agent-memory-cli startup sync --agent codex
Repository Layout
AGENTS.md / CLAUDE.md / GEMINI.md operating contracts for agents working on this repo
bin/ agent-memory-mcp · agent-memory-cli · agent-memory-message-gateway
policies/ fail-closed Policy Engine (permissions, sensitivity, export, budgets, staleness, inference)
agents/registry.md descriptive agent roster
profile/ · projects/ · wiki/ Zone A — curated canonical memory (edit the templates)
captures/ · sources/ · reports/ Zone B — raw captures, session evidence & Dreaming drafts
inbox/ proposals/ · needs-review/ · rejected/ · transactions/ (review gate)
exports/ codex/ · claude/ · antigravity/ · gemini/ · hermes/ · openclaw/ (derived)
gateway/ Telegram, Feishu WS & WeChat ClawBot (OpenClaw plugin) routing/rate limits
secrets/ refs.yaml & devices.yaml (backend pointers only — zero secret values)
scripts/ · tests/ · evals/ 7 phase suites, 108+ regressions, public-boundary & review benchmarks
docs/ usage, security-hardening, secret-manager-recipes, phone-gateway, upgrade reports
Validate
python3 scripts/validate_upgrade.py --portable # 7 phase suites + Python regressions + secret scan
python3 scripts/check_public_release.py # public-distribution privacy boundary
node --test tests/test_openclaw_wechat.mjs # WeChat ClawBot capture hook tests
# Prefix LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 if your locale defaults to ASCII
License
MIT — see LICENSE. See ROADMAP.md for what is built vs. intentionally deferred.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi