Skip to content

feat: add soul_sync MCP tool — one-call auto-recall + auto-observe - #320

Open
sshekhar563 wants to merge 2 commits into
qbtrix:devfrom
sshekhar563:feat/soul-sync
Open

sshekhar563 wants to merge 2 commits into
qbtrix:devfrom
sshekhar563:feat/soul-sync

Conversation

@sshekhar563

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds soul_sync — a new MCP tool that combines auto-recall + auto-observe into a single call. Agents sync a conversation turn with the soul in one round-trip instead of calling soul_recall then soul_observe separately.

New: AutoObserveMiddleware

  • Wraps a Soul so every conversation turn is captured automatically
  • Single turn() method: optional recall (when query is provided) + mandatory observe
  • Returns recalled memories + soul state (mood, energy, user_id)
  • Reusable runtime primitive for MCP, gateways, and SDKs

New: soul_sync MCP tool

Files changed

File Change
src/soul_protocol/runtime/middleware/auto_observe.py New — AutoObserveMiddleware class
src/soul_protocol/runtime/middleware/__init__.py Export AutoObserveMiddleware
src/soul_protocol/mcp/server.py Add soul_sync tool
src/soul_protocol/cli/setup.py Update setup instructions
README.md Update MCP tools docs
tests/test_mcp/test_server.py 2 new tests
tests/test_memory_layers/test_auto_observe_middleware.py New — middleware unit tests

How to test

uv run pytest tests/test_mcp/test_server.py -v -k "soul_sync"
uv run pytest tests/test_memory_layers/test_auto_observe_middleware.py -v

Checklist

  • New feature with tests
  • Ruff format + check pass
  • No existing tests broken
  • Documentation updated (README, CLI setup)

- Add AutoObserveMiddleware (auto_observe.py): wraps a Soul so every
  conversation turn is captured automatically. Single turn() method
  performs optional recall + mandatory observe, returning memories
  and soul state.
- Add soul_sync MCP tool (server.py): exposes AutoObserveMiddleware
  as an MCP tool so agents sync a turn in one round-trip instead of
  separate soul_recall + soul_observe calls.
- Export AutoObserveMiddleware from middleware __init__.py
- Update CLI setup instructions to reference soul_sync
- Update README MCP tools documentation
- Add tests: test_soul_sync_observe_only, test_soul_sync_with_recall,
  test_auto_observe_middleware unit tests
test_registered_tool_list_matches_public_mcp_surface pins the exact set
of registered MCP tools; the new soul_sync tool was missing from
EXPECTED_MCP_TOOLS, failing CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant