feat: system prompt injection for memory MCP - #69
Merged
Conversation
Add build_system_prompt() to claw/core/agent.py and pass it via the system_prompt field on ClaudeAgentOptions in create_client(). Also add CLAUDE.md at repo root as belt-and-suspenders (picked up via cwd). Instructs Claude to use read_memory()/write_memory() from the claw-memory MCP server and warns against local filesystem persistence. Closes #68 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ystem prompt Replaces plain string system_prompt with SystemPromptPreset(type="preset", preset="claude_code", append=...) so skills, MCP descriptions, and default Claude Code behavior are preserved. Memory instructions are appended only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build_system_prompt(config)toclaw/core/agent.py— returns instructions for Claude to useread_memory()/write_memory()from the claw-memory MCP servercreate_client()via thesystem_promptfield onClaudeAgentOptionsCLAUDE.mdat repo root as belt-and-suspenders (auto-discovered viacwd=repo_root)Closes #68
Test plan
TestBuildSystemPrompt(5 tests): validates prompt content includes read_memory, write_memory, filesystem warning, structured sectionsTestSystemPromptInCreateClient(1 test): verifies system_prompt is set in ClaudeAgentOptionsTestClaudeMd(2 tests): verifies CLAUDE.md exists and contains memory instructionsuv run pytest --tb=short -q→ 274 passed🤖 Generated with Claude Code