Files
claude-mem/openclaw/openclaw.plugin.json
T
Glucksberg 9361e33b6d fix(openclaw): inject context via system prompt instead of overwriting MEMORY.md (#1386)
* fix(openclaw): inject context via system prompt instead of overwriting MEMORY.md

The OpenClaw plugin was overwriting each agent's MEMORY.md with a large
auto-generated observation dump (~12-15KB) on every before_agent_start
and tool_result_persist event. This conflicts with OpenClaw's design
where MEMORY.md is agent-curated long-term memory.

Migrate context injection from file-based (writeFile MEMORY.md) to
OpenClaw's native before_prompt_build hook, which returns context via
appendSystemContext. This keeps MEMORY.md under agent control while
still providing cross-session observation context to the LLM.

Changes:
- Add before_prompt_build hook that returns { appendSystemContext }
- Remove writeFile/MEMORY.md sync from before_agent_start
- Remove MEMORY.md sync from tool_result_persist (observations still recorded)
- Add 60s TTL cache to avoid re-fetching context on every LLM turn
- Add syncMemoryFileExclude config for per-agent opt-out
- Remove dead workspaceDirsBySessionKey tracking map
- Rewrite test suite to verify prompt injection instead of file writes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ui): align settings defaults with backend and use nullish coalescing

The web UI had two issues causing settings inflation:

1. DEFAULT_SETTINGS in the UI used FULL_COUNT='5' and all token columns
   'true', while SettingsDefaultsManager (backend) uses FULL_COUNT='0'
   and token columns 'false'. Opening the settings modal and saving
   without changes would silently inflate the context.

2. useSettings used || for fallback, which treats '0' and 'false' as
   falsy — even when the backend correctly returns these values, the UI
   would replace them with inflated defaults. Changed to ?? (nullish
   coalescing) so only null/undefined trigger the fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(openclaw): update integration docs for system prompt injection

Reflect the migration from MEMORY.md file writes to before_prompt_build
hook-based context injection:

- Update architecture diagram and overview to show new hook flow
- Replace "MEMORY.md Live Sync" section with "System Prompt Context Injection"
- Update event lifecycle steps (before_agent_start, tool_result_persist)
- Add before_prompt_build step with TTL cache description
- Document new syncMemoryFileExclude config parameter
- Update session tracking to reflect removed workspaceDirsBySessionKey

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: fix terminology and update SKILL.md for system prompt injection

Replace "prompt injection" with "context injection" in docs to avoid
confusion with the OWASP security term. Update openclaw/SKILL.md to
reflect the new before_prompt_build hook and remove stale MEMORY.md
references.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Alex Newman <thedotmack@gmail.com>
2026-03-17 17:14:30 -07:00

93 lines
3.6 KiB
JSON

{
"id": "claude-mem",
"name": "Claude-Mem (Persistent Memory)",
"description": "Official OpenClaw plugin for Claude-Mem. Records observations from embedded runner sessions and streams them to messaging channels.",
"kind": "memory",
"version": "10.4.1",
"author": "thedotmack",
"homepage": "https://claude-mem.com",
"skills": ["skills/make-plan", "skills/do"],
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {
"syncMemoryFile": {
"type": "boolean",
"default": true,
"description": "Inject observation context into the agent system prompt via before_prompt_build hook. When true, agents receive cross-session context without MEMORY.md being overwritten."
},
"syncMemoryFileExclude": {
"type": "array",
"items": { "type": "string" },
"default": [],
"description": "Agent IDs excluded from automatic context injection (observations are still recorded, only prompt injection is skipped)"
},
"workerPort": {
"type": "number",
"default": 37777,
"description": "Port for Claude-Mem worker service"
},
"project": {
"type": "string",
"default": "openclaw",
"description": "Project name for scoping observations in the memory database"
},
"observationFeed": {
"type": "object",
"description": "Live observation feed — streams observations to any OpenClaw channel in real-time",
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"description": "Enable live observation feed to messaging channels"
},
"channel": {
"type": "string",
"description": "Channel type: telegram, discord, signal, slack, whatsapp, line"
},
"to": {
"type": "string",
"description": "Target chat/user ID to send observations to"
},
"botToken": {
"type": "string",
"description": "Optional dedicated Telegram bot token for the feed (bypasses gateway channel)"
},
"emojis": {
"type": "object",
"description": "Emoji personalization for the observation feed. Each agent gets a unique emoji automatically — customize here to override.",
"properties": {
"primary": {
"type": "string",
"default": "🦞",
"description": "Emoji for the main OpenClaw gateway (project='openclaw')"
},
"claudeCode": {
"type": "string",
"default": "⌨️",
"description": "Emoji for Claude Code sessions (non-OpenClaw)"
},
"claudeCodeLabel": {
"type": "string",
"default": "Claude Code Session",
"description": "Display label prefix for Claude Code sessions in the feed (project identifier is appended automatically)"
},
"default": {
"type": "string",
"default": "🦀",
"description": "Fallback emoji when no match is found"
},
"agents": {
"type": "object",
"default": {},
"description": "Pin specific emojis to agent IDs (e.g. {\"devops\": \"🔧\"}). Agents not listed here get auto-assigned emojis.",
"additionalProperties": { "type": "string" }
}
}
}
}
}
}
}
}