Skip to content

feat: add MemPalace integration plugin#35

Open
thekbbohara wants to merge 1 commit intoSafeRL-Lab:mainfrom
thekbbohara:feature/mempalace-integration
Open

feat: add MemPalace integration plugin#35
thekbbohara wants to merge 1 commit intoSafeRL-Lab:mainfrom
thekbbohara:feature/mempalace-integration

Conversation

@thekbbohara
Copy link
Copy Markdown
Contributor

  • Bridge tools (MempalaceSearch, MempalaceSave, MempalaceWakeUp, MempalaceKGQuery, MempalaceDiaryWrite) work via direct Python import — no MCP config needed
  • SKILL.md with session protocol, tool reference, and setup guide
  • hooks.py for auto-save on session lifecycle (start, stop, precompact)
  • plugin.json manifest for CheetahClaws plugin system
  • MCP server config for full 19-tool MemPalace experience
  • README.md with quick start and configuration docs

MemPalace is a local AI memory system with 96.6% recall, using ChromaDB semantic search and a temporal knowledge graph. Zero cloud, zero API keys. This integration makes it a first-class CheetahClaws plugin — installable, discoverable, and auto-configured.

- Bridge tools (MempalaceSearch, MempalaceSave, MempalaceWakeUp, MempalaceKGQuery, MempalaceDiaryWrite)
  work via direct Python import — no MCP config needed
- SKILL.md with session protocol, tool reference, and setup guide
- hooks.py for auto-save on session lifecycle (start, stop, precompact)
- plugin.json manifest for CheetahClaws plugin system
- MCP server config for full 19-tool MemPalace experience
- README.md with quick start and configuration docs

MemPalace is a local AI memory system with 96.6% recall, using
ChromaDB semantic search and a temporal knowledge graph. Zero cloud,
zero API keys. This integration makes it a first-class CheetahClaws
plugin — installable, discoverable, and auto-configured.
@chauncygu
Copy link
Copy Markdown
Contributor

Hi @thekbbohara,

Thanks for the contribution and the thorough documentation!

However, I don't think this should be merged into the core repo. A few reasons:

Architecture mismatch — this won't work as-is:

  • integrations/mempalace/ is not in the plugin loader's search path (~/.cheetahclaws/plugins/ or .cheetahclaws/plugins/), so the code would never be loaded.
  • tools.py calls register_tool() at module level, but the plugin loader expects a TOOL_DEFS list export.
  • hooks.py defines hook_session_start/hook_stop/hook_precompact, but CheetahClaws doesn't have an event-based hooks system — the existing hooks are checkpoint file-write interceptors only.
    These functions would never be called.

Design concerns:

  • CheetahClaws already has a built-in memory system (MemorySave, MemorySearch, MemoryList, MemoryDelete) that covers the core use case.
  • chromadb is a heavy dependency (~hundreds of MB) for a lightweight CLI tool. The graceful degradation only covers mempalace, not chromadb — direct import chromadb in _mempalace_save and
    others would crash without it.
  • A third-party integration plugin belongs in its own repo, not bundled into core.

Recommendation:
This would work great as a standalone plugin repo. Users who want it can install via /plugin install mempalace@. To make that work, you'd need to:

  1. Export TOOL_DEFS (list of ToolDef objects) instead of calling register_tool() directly
  2. Remove the hooks (or wait for us to add an event-based hook system)
  3. Wrap chromadb imports with the same graceful degradation as mempalace

Happy to help if you want to restructure it as a standalone plugin!

nekocheik pushed a commit to nekocheik/cheetahclaws-fork that referenced this pull request Apr 19, 2026
…detection

Add Matrix bridge mirroring telegram.py pattern, wrapped around matrix-nio
AsyncClient inside a dedicated asyncio loop on a worker thread.

Features:
- A2A envelope auto-detection: content.lstrip().startswith('{"a2a":"1"')
- Corr_id pending map + results dict for SafeRL-Lab#35 corr_id poll pattern prep
- Sync mx_send() helper schedules coroutines via run_coroutine_threadsafe
- Graceful degradation when matrix-nio not installed (clear stderr msg)
- MATRIX_BRIDGE export dict for cmd_matrix slash command registration
- register_a2a_handler hook for SafeRL-Lab#35 native a2a_delegate tool wiring

Not added to pyproject.toml dependencies yet (matrix-nio = follow-up
optional dep commit to keep core deps minimal).

Pending wiring: _drain_mx_queue() must be hooked into main REPL tick
loop (caller integration, not this commit's scope). Subagent scaffold
410L (~210 dense, ~200 docstring/blank) per architech review.

refs SafeRL-Lab#33 SafeRL-Lab#35
nekocheik pushed a commit to nekocheik/cheetahclaws-fork that referenced this pull request Apr 19, 2026
Native cheetahclaws A2A v1 delegation via Matrix bridge (SafeRL-Lab#33).

a2a_delegate(target_mxid, task, ...): emits delegate envelope via
mx_send, registers corr_id in _mx_a2a_pending, returns immediately.
Agent stays free to continue other work.

a2a_poll_result(correlation_id, timeout_sec=90): blocks on pending
event until result envelope arrives OR timeout. One-shot consume
(pop pending+result). Returns timeout status on deadline, error on
unknown/consumed corr_id.

Design addresses pilot SafeRL-Lab#6: sync tool exec blocked main loop for
30-120s on round-trips. Poll pattern decouples submit from await.

Smoke tests PASS: registration + schema + no-bridge + missing-param
+ unknown-corr + E2E mock roundtrip (0.5s roundtrip) + timeout path.

Pending wiring: register_a2a_handler runtime init hook, matrix-nio
optional-dependencies add.

refs SafeRL-Lab#33 SafeRL-Lab#35
nekocheik pushed a commit to nekocheik/cheetahclaws-fork that referenced this pull request Apr 19, 2026
Pre-POC bundle wires Silverhawk fork MVP core into cheetahclaws runtime:

1. cheetahclaws.py: import bridges.matrix + tools.a2a_delegate,
   COMMANDS['matrix']=cmd_matrix, COMMAND_HELP entry
2. web/api.py: add bridges.matrix to bridge auto-discovery
3. pyproject.toml: silverhawk-matrix optional = matrix-nio>=0.24.0
4. bootstrap.py: step 2.b register_a2a_handler logging POC handler,
   non-fatal if bridge absent

Smoke PASS: COMMANDS wired, tools registered, bootstrap runs clean,
pip install -e '.[silverhawk-matrix]' installable.

MVP core pre-POC wiring complete. Ready SafeRL-Lab#38 E2E.

refs SafeRL-Lab#33 SafeRL-Lab#35 SafeRL-Lab#38
nekocheik pushed a commit to nekocheik/cheetahclaws-fork that referenced this pull request Apr 19, 2026
… attribution

Add SILVERHAWK-FORK.md explaining:
- Why Silverhawk forks cheetahclaws (V2 chat brick pivot per user directive)
- What's customized (5 commits mapped: license, MCP, Matrix, a2a, wiring)
- Integration map pointers (docs/cheetahclaws-arch-map.md,
  docs-silverhawk/mcp-silverhawk-plug.md)
- Upstream tracking + contribution-back candidates (license fix)
- License Apache-2.0 matches upstream

Separate from upstream README.md (preserved as-is) to keep delta clear.

refs SafeRL-Lab#32 SafeRL-Lab#33 SafeRL-Lab#34 SafeRL-Lab#35 SafeRL-Lab#46 SafeRL-Lab#53
nekocheik pushed a commit to nekocheik/cheetahclaws-fork that referenced this pull request Apr 19, 2026
…-serve.py + launch runbook

Wire Path B option δ for POC SafeRL-Lab#38: cheetahclaws runs standalone Matrix
agent bypassing chat-server-bin.

Adds:
- CLAUDE.md at fork root: pilot role overlay (Cas A forward-verbatim +
  MXID roster + A2A rules) sourced from DevopMaster agent/roles/prompts/
  pilot.md. Cheetahclaws reads it as system context.
- scripts/silverhawk-matrix-serve.py: standalone launcher binding matrix
  bridge inbound queue → agent.run() → mx_send outbound reply. Bypasses
  chat-server-bin entirely. SIGTERM-safe, accept_all permissions for POC.
- docs-silverhawk/poc-38-launch-spec.md: runbook for devop-master (new
  Matrix token generation via Dendrite login, stop classic supervisor
  units, launch cheetahclaws standalone, smoke probe, observation setup,
  POC run plan, rollback).

Closes wiring gap flagged post-SafeRL-Lab#37 (cheetahclaws installed but not
active runtime). Enables true POC thesis validation.

refs SafeRL-Lab#33 SafeRL-Lab#34 SafeRL-Lab#35 SafeRL-Lab#37 SafeRL-Lab#38
nekocheik pushed a commit to nekocheik/cheetahclaws-fork that referenced this pull request Apr 19, 2026
…Lab#56

Add scripts/silverhawk-launch.sh (bash wrapper):
- Sources /usr/local/bin/glm to export ANTHROPIC_AUTH_TOKEN + BASE_URL
  (z.ai gateway Anthropic-compat for glm-* models)
- Parses /home/ide/.config/matrix/credentials.json for MATRIX_*
- Uses pkill pattern for stop-start swap (supervisorctl broken in
  these containers per preflight audit SafeRL-Lab#56)
- Execs silverhawk-matrix-serve.py in foreground

Update runbook poc-38-launch-spec.md per preflight findings:
- No new Matrix token generation needed (reuse credentials.json +
  stop-start swap frees the @testbot session cleanly)
- pkill stop pattern (supervisord lacks [supervisorctl] section)
- Cred sourcing inline from /usr/local/bin/glm + credentials.json
- Simplified 6-step checklist (fork pull → matrix-nio install →
  creds confirm → stop classic via launcher → launch → smoke)
- Rollback procedure (pkill serve + nohup restart classic)

refs SafeRL-Lab#33 SafeRL-Lab#34 SafeRL-Lab#35 SafeRL-Lab#37 SafeRL-Lab#38 SafeRL-Lab#56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants