---
actual_hours: null
assignees: []
created_at: '2025-08-20T09:26:19.522014'
dependencies: []
description: 'Migrate src/claude_mpm/cli/commands/memory.py to use the new shared
  utilities.


  ## Current State

  - 1024 lines of code with duplication

  - Complex memory management logic

  - Inconsistent error handling

  - Direct path resolution


  ## Target State

  - Use MemoryCommand base class (extends BaseCommand)

  - Shared argument parsing for memory operations

  - Standardized memory directory resolution

  - Consistent output formatting


  ## Implementation Steps

  1. Import shared utilities: MemoryCommand, handle_cli_errors, add_memory_arguments

  2. Create MemoryCommand class inheriting from BaseCommand

  3. Use PathResolver for memory directory resolution

  4. Replace argument parsing with shared patterns

  5. Update error handling to use CLIErrorHandler

  6. Implement consistent output formatting

  7. Test all memory operations (list, add, clean, etc.)


  ## Expected Outcome

  - ~45% code reduction (1024 → ~560 lines)

  - Consistent memory directory handling

  - Better error messages and user experience


  ## Files to Modify

  - src/claude_mpm/cli/commands/memory.py

  - src/claude_mpm/cli/parsers/memory_parser.py (if exists)


  ## Special Considerations

  - Memory directory resolution using PathResolver

  - Agent memory file discovery

  - Memory aggregation and analysis features'
due_date: null
estimated_hours: null
id: TSK-0130
labels: []
metadata:
  blocked_by: []
  blocks: []
  epic: EP-0002
  estimate: 1h
  github_id: I_kwDOPScCe87HDEtz
  github_url: https://github.com/bobmatnyc/claude-mpm/issues/50
  parent: null
  platform: github
  subtasks: []
parent: null
priority: high
status: completed
tags: []
title: Refactor memory.py command to use shared utilities
updated_at: '2025-08-20T16:34:44.021729'
---

# Refactor memory.py command to use shared utilities

## Description
Migrate src/claude_mpm/cli/commands/memory.py to use the new shared utilities.

## Current State
- 1024 lines of code with duplication
- Complex memory management logic
- Inconsistent error handling
- Direct path resolution

## Target State
- Use MemoryCommand base class (extends BaseCommand)
- Shared argument parsing for memory operations
- Standardized memory directory resolution
- Consistent output formatting

## Implementation Steps
1. Import shared utilities: MemoryCommand, handle_cli_errors, add_memory_arguments
2. Create MemoryCommand class inheriting from BaseCommand
3. Use PathResolver for memory directory resolution
4. Replace argument parsing with shared patterns
5. Update error handling to use CLIErrorHandler
6. Implement consistent output formatting
7. Test all memory operations (list, add, clean, etc.)

## Expected Outcome
- ~45% code reduction (1024 → ~560 lines)
- Consistent memory directory handling
- Better error messages and user experience

## Files to Modify
- src/claude_mpm/cli/commands/memory.py
- src/claude_mpm/cli/parsers/memory_parser.py (if exists)

## Special Considerations
- Memory directory resolution using PathResolver
- Agent memory file discovery
- Memory aggregation and analysis features

## Details
- **Status**: completed
- **Priority**: high
- **Assignees**: None
- **Tags**: None
- **Created**: 2025-08-20 09:26:19
- **Updated**: 2025-08-20 16:34:44

## Tasks
- [ ] Add task items here

## Notes
_Add any additional notes or context here._
