Repository navigation
Description
Existing Issue Search
- I searched existing issues and will add evidence to a canonical tracker when applicable.
Related: #2242 (canonical stale-server report, closed by #2311), #1708 (Codex equivalent, closed with upgrade guidance), #2362 (listener PID on Unix), #1357 (Homebrew managed service).
📝 Observed Consequence
After an in-place binary upgrade, a manually started engram serve from an old release kept listening on 127.0.0.1:7437. From then on, every Claude Code write tool (mem_save, mem_update, mem_judge, …) was denied by the plugin's PreToolUse gate:
PreToolUse:mcp__engram__mem_save hook error: Claude managed local server identity unconfirmed: expected current data directory instance
Read tools (mem_search, mem_context) kept working, because the gate only matches write tools and engram mcp opens the store directly. So memory looked healthy while nothing could be saved. Nothing on the local-only install pointed at the cause:
- the denial reports neither the observed server release nor what to do;
engram psreportsunmanaged Engram listener on port 7437 (owning PID unavailable)with no versions;engram cloud statusprintsnot configuredand never reaches the local daemon;engram doctor(10 checks) inspects only the store.
The skew report added by #2311 is therefore unreachable in this setup: it covers only pidfile-managed daemons (ps) and cloud-configured installs (cloud status).
The stale process had been running about two months. The gate denied writes correctly; the gap is the missing diagnosis.
sequenceDiagram
autonumber
participant CC as Claude Code
participant Hook as PreToolUse gate<br/>(engram 3.7.2)
participant Srv as engram serve on :7437<br/>(stale 0.1.0, no supervisor)
participant MCP as engram mcp (3.7.2)
participant DB as Store (data dir)
Note over CC,MCP: Read path: not gated
CC->>MCP: mem_search
MCP->>DB: open store directly
DB-->>CC: results OK
Note over CC,Srv: Write path: gated
CC->>Hook: mem_save
Hook->>DB: EnsureInstanceID(data dir) gives expected id
Hook->>Srv: GET /health
Srv-->>Hook: {"status":"ok","service":"engram","version":"0.1.0"} (no instance_id)
Hook-->>CC: deny: "identity unconfirmed" (version 0.1.0 is discarded)
Note over Hook: Proposed: report server 0.1.0 vs CLI 3.7.2<br/>and restart guidance, as the Codex guard does (#1708)
🔄 Steps to Reproduce
- Start
engram servemanually, with no supervisor (no launchd, systemd orengram run -d), from a release whose/healthhas noinstance_id. Observed with 0.1.0. - Upgrade the binary in place, same path (Homebrew), to 3.7.2. Do not stop the running server.
- Install the Claude Code plugin 0.1.23 and register the MCP (
engram setup claude-code). - In a Claude Code session, call
mem_search: it succeeds. - Call
mem_save: it is denied with the message above. - Run
engram ps,engram cloud status(no cloud configured) andengram doctor: none of them reports the release skew.
✅ Expected Behavior
Writes stay blocked, which is correct, but the operator gets an actionable diagnosis:
- Claude Code denial with skew guidance. When
/healthanswersstatus: ok,service: engrambut itsinstance_idis missing or mismatched, the denial includes the observed serverversionand the installed CLI version, plus the restart guidance. That parity already exists for the Codex guard since bug(codex): stale Engram core denies all memory writes; guard fails closed without capability negotiation or upgrade guidance #1708. Example:stale Engram server on :7437 (server 0.1.0, CLI 3.7.2): restart it through its supervisor, or stop it and run engram run -d. engram psversions for unmanaged listeners. Following fix(cli): report running server release skew and pending restart #2311, an unmanaged listener's/healthversion is shown as diagnostic-only metadata, with no signaling and no adoption, e.g.unmanaged listener on 7437, server 0.1.0; installed CLI 3.7.2; restart pending.- Optional
doctorcheck. Compares the reachable configured listener's release with the CLI. It can stay diagnostic-only, like the other checks.
❌ Actual Behavior
- Writes are denied with
managed local server identity unconfirmed: expected current data directory instance. No version and no guidance. /healthfrom the stale server:{"service":"engram","status":"ok","version":"0.1.0"}.engram ps:unmanaged Engram listener on port 7437 (owning PID unavailable); not managed by this pidfile; not signaling or adopting it; verify the owner locally and stop it manually if appropriate.engram cloud status:Cloud status: not configured (no effective server URL).engram doctor: no finding related to the running server.
Operating System
macOS
Release Version (Report Context)
engram 3.7.2 (Homebrew); Claude Code plugin 0.1.23; stale server 0.1.0
Agent / Client
Claude Code
📋 Relevant Logs
Before (stale server):
$ engram version
engram 3.7.2
$ ps -o ppid,command -p <pid>
1 engram serve
$ curl -s http://127.0.0.1:7437/health
{"service":"engram","status":"ok","version":"0.1.0"}
Mitigation: kill <pid>, then engram run -d.
After:
$ curl -s http://127.0.0.1:7437/health
{"capabilities":{...},"daemon_token":"<redacted>","instance_id":"<redacted>","service":"engram","status":"ok","version":"3.7.2"}
$ engram ps
running (pid <pid>) on port 7437
Versions: server 3.7.2; installed CLI 3.7.2
The mem_save that had been denied was retried and accepted.
💡 Additional Context
- The denial is raised in
cmd/engram/hook_local_server.go(confirmHookLocalIdentityandhookLocalHealthMatches). The health body is already parsed there, so the observedversionis available without an extra request. - Fail-closed behavior and "hooks never restart the server" (README, DOCS) are correct and should stay. This report asks only for diagnosis.
- Workaround for others:
curl -s 127.0.0.1:7437/health, compareversionwithengram version, and run the server under a supervisor orengram run -dsopsandrestartcan manage it. - I'm reporting this. I'm not volunteering to implement it, but I'm happy to test a fix.
Activity
dnlrsls commentedon Nov 21, 2026
Maintainer triage
Reproduced on canonical main
ef8f2978d5d1f09b13ab5b4d93329d805e187349with a Windows CLI built from that commit and a disposable data directory. A loopback fixture returned the reported/healthshape with statusok, serviceengram, version0.1.0, and no instance ID. The realengram hook claude-pre-tool-usedenied the write with the exact generic message. The listener saw only a singleGET /health.The shared local health reader currently discards the version during identity checking. First delivery: add diagnostic-only release guidance to that denial when the bounded, complete health response identifies Engram and reports a comparable version different from the installed CLI. Keep the independent instance check before session or directory traffic, the generic fallback for invalid/unknown versions, the current redirect and recovery rules, and the explicit URL behavior. Version metadata cannot confer identity or authority over a process. Test missing/mismatched identity, matching identity, same-version and malformed metadata, and a listener that never receives any request beyond health on denial.
Use
Refs #2401. The unmanagedengram psview and any doctor check remain outside this delivery.dnlrsls commentedon Nov 21, 2026
Unmanaged ps follow-up
On current canonical main
80291ed42ea3673c88e9f147b442ec0f5c8a9bec, a Windows CLI built with release version 3.7.2 issued oneGET /healthto a disposable loopback listener reporting Engram 0.1.0. With no pidfile,engram psexited 1 and correctly reported occupied/unmanaged. The version already returned by the bounded daemon probe was discarded from this diagnostic.Approved next scope: reuse the existing probe for the unmanaged listener reported by
engram psand display bounded validated release information. Keep the exit status, pidfile policy, token authority and stop/restart/start behavior. Test missing/stale/mismatched pidfile states, an unrelated service, unknown releases and one health request per status check. Keep the optional doctor check outside this follow-up.dnlrsls commentedon Nov 21, 2026
Closing as completed in main. #2417 reports both versions when a stale localhost server blocks the Claude hook. #2418 gives the same version information in engram ps for the unmanaged listener. Both paths were verified with the native Windows CLI against an isolated loopback fixture. The latest release, v3.7.2, predates these changes. Verification on the original macOS/Homebrew setup is welcome once the changes ship.