Repository navigation
One hub for every machine: a shared-brain setup, and a "new" Claude Code plugin for the client side #2671
shanelord01
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Mempalace is awesome - but having it tied to one machine just never worked for me. I need to be able to access it from wherever I am... desktop, laptop or mobile - at home, in the office or in a cafe.
So I setup MemPalace as a shared-brain hub: one
mempalace servewith Qdrant on a home server.Now every Claude Code machine, the Claude apps and a Hermes bot read and write through it. This post
is what the setup looks like end to end, and a plugin I wrote for the part the official plugin
does not cover. Feedback welcome, especially from anyone running more than one agent against a hub.
The hub
The hub follows the remote-server guide, with one addition. It binds to loopback on a machine
with no open inbound ports and is reached through a Pangolin tunnel. In front of it sits a small
Caddy container built with caddy-jwt that checks a Pocket ID OAuth token on every request and
swaps it for the hub's static token. Claude Code, Claude Desktop, the mobile apps and claude.ai
all log in with a passkey, and the hub itself is unchanged. The full walkthrough, with a check
after each stage, is here:
https://github.com/shanelord01/claude-mempalace-sharedbrain/blob/main/docs/hub-setup.md
What the client side was missing
Reading the 3.11.0 source: the Claude Code plugin's Stop, SessionEnd and PreCompact hooks run
mempalace hook runfrom the local Python package, and the package finds a hub only through aregistry file on the hub's own machine. On a laptop whose only palace is a remote hub, those
hooks have nothing to save to.
mempalace rulesrenders the shared-brain block for CLAUDE.md,but it prints to stdout and needs the package installed. The shared-brain guide's section 5 and
7 (wire the protocol in, keep agents wakeable) were the parts I had to do by hand on every
machine, and they drifted.
The plugin
https://github.com/shanelord01/claude-mempalace-sharedbrain
It is the client half of the shared-brain guide for Claude Code, with no
mempalacepackage onthe machine. It adds no protocol wording of its own. MemPalace's texts travel verbatim.
mempalace rulesdoes (the template isvendored with its upstream commit and hash, and the CLI is used instead when it is present),
and installs, checks or replaces it in place in
~/.claude/CLAUDE.md. Every session startreports whether the installed block is current, stale or missing.
host:harness:projectidentity from the working directory.exact
mempalace_event_listcalls to make from the cursor, or the results when the hook has itsown path to the hub.
logstream watch, so whenthe user arms listening, each prompt triggers one sweep since the watch cursor for
task.request,task.replyandpatch.ready, excluding the identity's own events. Armingprints the announcement the protocol asks for, disarming the declared-idle statement.
turns in MemPalace's own wording, and a pre-compaction snapshot handed back after compaction.
mempalace_task_create, wait, verify the sha256, ack, filethe outcome), checkpoints (
mempalace_checkpoint) and fleet state (mempalace_mesh_peers,/statusz).By default the hooks hold no credential. The model's logged-in MCP server makes every hub call,
and the hooks only tell it which calls to make and when. Optionally the hooks can read the hub
themselves, with the hub's static token or, for a hub behind an OAuth login, the client
credentials grant with a confidential client per machine.
Install:
Why bother
Before this, a task addressed to one of my machines sat unacknowledged for ten days because no
session on it happened to check the inbox. The rules block in each CLAUDE.md was pasted by hand
and three machines were on three versions, one citing a drawer that no longer existed. One
install command per machine now puts the same block, the same identity rule and the same sweep
in front of every session, and an update is one more command.
Things I would like opinions on
host:claude:<workspace>as the protocolsays. That means one inbox per project per machine, and a requester has to know which project
the worker is in or broadcast. If you run a fleet, how do you address a machine as a whole?
mempalace_diary_writerejects anagent_namecontaining colons (sanitize_nameallows wordcharacters, space, dot, apostrophe and hyphen), so a
host:harness:projectidentity cannot bea diary name as-is. The plugin writes the diary under the identity with colons replaced by
underscores. Is there an intended convention for this?
armed. An
mcp_toolhook would avoid that if its input could carry a cursor. Is there abetter pattern?
know whether
python3resolved.MIT, tests included (
tests/run.sh, a fake hub over HTTP, SSE and stdio).All reactions