Skip to content

Add a CLI, fix compaction #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 13, 2025
Merged

Add a CLI, fix compaction #6

merged 4 commits into from
May 13, 2025

Conversation

abrookins
Copy link
Contributor

Adds a dedicated agent-memory CLI and fixes the compaction task.

@Copilot Copilot AI review requested due to automatic review settings May 13, 2025 18:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a standalone CLI for the agent-memory server, improves default namespace handling in the MCP tool, and refines the memory compaction workflow.

  • Add a Click-based agent-memory CLI with api, mcp, and schedule-task commands
  • Extend FastMCP to inject a default namespace and ensure the Redis search index before startup
  • Refactor compaction logic to handle missing indexes dynamically and use safe data access

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_mcp.py Added test_default_namespace_injection to verify namespace use
agent_memory_server/utils/redis.py Added memory_hash field to the Redis search index schema
agent_memory_server/mcp.py Extended FastMCP for namespace injection and CLI integration
agent_memory_server/long_term_memory.py Refactored compaction to check index and use safe value lookup
agent_memory_server/logging.py Configured stdlib logging integration and structlog setup
agent_memory_server/config.py Introduced log_level setting with Literal type
agent_memory_server/cli.py Updated mcp command to accept --mode and unified setup
README.md Updated usage examples for the new CLI commands
Comments suppressed due to low confidence (3)

agent_memory_server/mcp.py:108

  • The Namespace class is not imported in this file, causing a NameError when injecting the default namespace. Please add an import such as from mcp.types import Namespace at the top.
arguments["namespace"] = Namespace(eq=namespace)

agent_memory_server/long_term_memory.py:521

  • Later calls to safe_get require the safe_get function, but it is not imported in this module. Please add from agent_memory_server.utils.redis import safe_get (or the correct path) at the top.
for doc in getattr(vector_search_result, "docs", []):

agent_memory_server/cli.py:77

  • The variable logger is not defined in this file. You should either use logging.getLogger(__name__) to define logger or call logging.info(...) directly.
logger.info(f"Starting MCP server on port {port}\n")

@abrookins abrookins merged commit c08e4fd into main May 13, 2025
3 checks passed
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