hermes - 💡(How to fix) Fix [Bug/Practice]: Mem0 setup writes API key inline in mem0.json on some install paths [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#25085Fetched 2026-05-14 03:49:06
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Root Cause

Config files are routinely:

  • Committed to git when users version their ~/.hermes for cross-machine sync
  • Shared in screenshots when asking for help
  • Bundled in tarballs / backups without secret-scrubbing
  • Tab-completed and cat'd in pair-programming sessions

.env carries a much stronger "this contains secrets" signal in convention and tooling (gitignore patterns, IDE secret detection, etc.).

Code Example

{
  "api_key": "m0-...",
  "user_id": "matvey",
  "agent_id": "echo",
  "rerank": true
}

---

MEM0_API_KEY=m0-...

---

{
  "user_id": "matvey",
  "agent_id": "echo",
  "rerank": true
}
RAW_BUFFERClick to expand / collapse

Problem

The Mem0 plugin config (~/.hermes/mem0.json) supports an api_key field inline in JSON. On some install paths the key ends up there instead of in ~/.hermes/.env, breaking the conventional secret-storage boundary.

Repro on a fresh VPS install: after running hermes memory setup and selecting Mem0, observe:

{
  "api_key": "m0-...",
  "user_id": "matvey",
  "agent_id": "echo",
  "rerank": true
}

instead of the cleaner:

~/.hermes/.env:

MEM0_API_KEY=m0-...

~/.hermes/mem0.json:

{
  "user_id": "matvey",
  "agent_id": "echo",
  "rerank": true
}

(The exact install path that produces inline-key vs env-key is unclear — I observed env-key on Mac and inline-key on VPS for the same Hermes version. Possibly tied to which wizard branch fires, or to whether .env exists at setup time.)

Why this matters

Config files are routinely:

  • Committed to git when users version their ~/.hermes for cross-machine sync
  • Shared in screenshots when asking for help
  • Bundled in tarballs / backups without secret-scrubbing
  • Tab-completed and cat'd in pair-programming sessions

.env carries a much stronger "this contains secrets" signal in convention and tooling (gitignore patterns, IDE secret detection, etc.).

Proposed solution

  1. Wizard: hermes memory setup always writes MEM0_API_KEY=... to ~/.hermes/.env (creating with chmod 600 if absent), never inline to mem0.json.
  2. Plugin loader: read os.environ["MEM0_API_KEY"] first, fall back to mem0.json[api_key] for back-compat, log a deprecation warning if key found in JSON.
  3. hermes doctor: detect inline api_key in any plugin config, surface as a warning with migration command (mv instructions or an automated hermes config migrate-secrets).

Backward compat

Existing inline-key configs keep working but trigger a one-line warning on every doctor run and every plugin load. After one minor version, support is removed.

Severity

Low-to-moderate. Not a "remote code execution" issue, but a real practice gap. Easy to fix, easy to regress without a doctor check.

Same shape applies to other plugin configs

honcho.json, supermemory.json, etc. — any plugin that takes an API key. Worth applying the env-first convention generically.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING