## ADDED Requirements ### Requirement: manage_memory tool The system SHALL provide a callable tool for creating, updating, and deleting persistent facts. #### Scenario: Create a new fact - **WHEN** `manage_memory(content="...", action="create")` is called - **THEN** a new fact SHALL be created with the provided content - **THEN** a unique ID SHALL be auto-generated - **THEN** the return value SHALL be `"created memory "` #### Scenario: Update an existing fact - **WHEN** `manage_memory(content="...", action="update", id="")` is called - **THEN** the fact SHALL be updated with the new content - **THEN** the return value SHALL be `"updated memory "` - **WHEN** no `id` is provided for an update action - **THEN** a ValueError SHALL be raised #### Scenario: Delete a fact - **WHEN** `manage_memory(action="delete", id="")` is called - **THEN** the fact SHALL be deleted - **THEN** the return value SHALL be `"Deleted memory "` - **WHEN** no `id` is provided for a delete action - **THEN** a ValueError SHALL be raised #### Scenario: Configurable permitted actions - **WHEN** creating the tool with `actions_permitted=("create", "update")` - **THEN** the delete action SHALL NOT be available - **THEN** attempting a delete SHALL raise a ValueError #### Scenario: Custom instructions - **WHEN** creating the tool with custom `instructions` - **THEN** those instructions SHALL be included in the tool description to guide LLM usage ### Requirement: search_memory tool The system SHALL provide a callable tool for searching stored facts by semantic query. #### Scenario: Text query search - **WHEN** `search_memory(query="preference for dark mode", limit=10)` is called - **THEN** the system SHALL perform hybrid search (vector + keyword) - **THEN** results SHALL be returned as a serialized JSON list of fact objects #### Scenario: Filtered search - **WHEN** `search_memory(query="...", filter={"category": "preference"})` is called - **THEN** results SHALL be filtered to match the specified criteria #### Scenario: Configurable response format - **WHEN** `response_format="content_and_artifact"` is configured - **THEN** the tool SHALL return both serialized memories and raw memory objects ### Requirement: Namespace isolation for multi-tenant The system SHALL support namespace-based isolation of memory data across users, agents, or organizations. #### Scenario: Runtime namespace resolution - **WHEN** a memory tool is called with a configuration containing `{"user_id": "u-123"}` - **THEN** the namespace SHALL be resolved to `("user", "u-123")` at runtime - **WHEN** calling with `{"org_id": "acme", "agent_id": "alpha"}` - **THEN** the namespace SHALL be `("org", "acme", "alpha")` #### Scenario: Namespace templating - **WHEN** creating memory tools with `namespace=("{user_id}", "memories")` - **THEN** the `{user_id}` placeholder SHALL be replaced at runtime from configuration - **WHEN** a required config key is missing - **THEN** a ConfigurationError SHALL be raised