Skip to content

Remove Memory Delete Feature

Plan Metadata

  • Plan type: plan
  • Parent plan: N/A
  • Depends on: docs/plans/delete-memory-api.md (plan being reversed)
  • Status: approved

Status semantics: - draft: Plan is being created or updated and is not final. - approved: Plan is approved but not yet applied in code. - documentation: Code currently exists and matches the plan contract.

Update rule: - When an existing plan is edited, set status to draft until re-approved.

System Intent

  • What is being built: Removal of the memory delete feature. This means deleting the MemoryDeleteMenu UI component and its references in the memory viewer modal, the deleteMemory API client, the useDeleteMemory hook in useMemoryApi.ts, the delete Lambda backend (api/memories/delete/), the SAM template entry for the delete function, and all associated test files.
  • Primary consumer(s): No consumer after removal — these code paths will no longer exist.
  • Boundary (black-box scope only):
  • Input: The existing codebase as merged from PR #541 (feature/delete-memory-api)
  • Output: Codebase with all delete-memory code paths removed; no references remain to the deleted files, the /memories/delete Lambda endpoint, or the MemoryDeleteMenu component

Stage Gate Tracker

  • [x] Stage 1 Mermaid approved
  • [x] Stage 2 I/O contracts approved
  • [x] Stage 3 pseudocode/technical details approved or skipped

1. Mermaid Diagram

Reference: .agent/skills/create-mermaid-diagram/SKILL.md

graph TD
    MemoryViewer["memory-viewer-modal.tsx — components/memory/memory-viewer-modal.tsx"]:::updated
    DeleteMenu["memory-delete-menu.tsx — components/memory/memory-delete-menu.tsx"]:::deleted
    DeleteClient["deleteMemory.ts — lib/api/memory/deleteMemory.ts"]:::deleted
    UseMemoryApi["useMemoryApi.ts — lib/api/memory/useMemoryApi.ts"]:::updated
    IndexScreen["index.tsx — app/app/index.tsx"]:::updated
    DeleteEndpoint["delete app.py — api/memories/delete/app.py"]:::deleted
    SAMTemplate["template.yaml — main/server/template.yaml"]:::updated
    TestDeleteMenu["memory-viewer-delete.test.tsx — __tests__/components/memory-viewer-delete.test.tsx"]:::deleted
    IntegrationTest["test_delete_memory_api.py — server/tests/integration/test_delete_memory_api.py"]:::deleted

    DeleteMenu -->|"imported by"| MemoryViewer
    DeleteClient -->|"imported by"| DeleteMenu
    DeleteClient -->|"imported by"| UseMemoryApi
    DeleteMenu -->|"rendered by"| MemoryViewer
    UseMemoryApi -->|"useDeleteMemory hook used by"| IndexScreen
    DeleteEndpoint -->|"registered in"| SAMTemplate
    DeleteMenu -->|"tested by"| TestDeleteMenu
    DeleteEndpoint -->|"tested by"| IntegrationTest

classDef unchanged fill:#d3d3d3,stroke:#666,stroke-width:1px;
classDef updated fill:#ffe58a,stroke:#666,stroke-width:1px;
classDef deleted fill:#f4a6a6,stroke:#666,stroke-width:1px;
classDef created fill:#a8e6a3,stroke:#666,stroke-width:1px;

2. Black-Box Inputs and Outputs

Global Types

MemoryId {
  value: string (stable unique identifier for a memory)
}

Flow: removeDeleteUI

  • Test files: main/app/__tests__/memory-viewer-modal.test.tsx
  • Core files: main/app/components/memory/memory-viewer-modal.tsx, main/app/components/memory/memory-delete-menu.tsx, main/app/app/index.tsx

Type Definitions

RemoveDeleteUIInput {
  existing_codebase: (PR #541 merged state)
}

RemoveDeleteUIOutput {
  memory-delete-menu.tsx: deleted
  memory-viewer-modal.tsx: MemoryDeleteMenu import and usage removed; onMemoryDeleted and onMemoryDeleteFailed props removed
  index.tsx: handleMemoryDeleted callback removed; onMemoryDeleted prop no longer passed to MemoryViewerModal
  memory-viewer-delete.test.tsx: deleted
  memory-viewer-modal.test.tsx: any delete-related assertions removed
}

Paths

path-name input output/expected state change path-type notes updated
removeDeleteUI.success Existing codebase MemoryDeleteMenu file deleted; import and render removed from memory-viewer-modal.tsx; onMemoryDeleted prop chain removed from index.tsx happy path No visible hamburger menu in memory viewer after this change Y

Flow: removeDeleteAPIClient

  • Test files: N/A
  • Core files: main/app/lib/api/memory/deleteMemory.ts, main/app/lib/api/memory/useMemoryApi.ts

Type Definitions

RemoveAPIClientInput {
  existing_codebase: (PR #541 merged state)
}

RemoveAPIClientOutput {
  deleteMemory.ts: deleted
  useMemoryApi.ts: useDeleteMemory export removed; deleteMemory import removed
}

Paths

path-name input output/expected state change path-type notes updated
removeDeleteAPIClient.success Existing codebase deleteMemory.ts deleted; useDeleteMemory removed from useMemoryApi.ts; deleteMemory import removed from useMemoryApi.ts happy path No compile-time or runtime references to deleteMemory remain in the frontend Y

Flow: removeDeleteBackend

  • Test files: main/server/tests/integration/test_delete_memory_api.py
  • Core files: main/server/api/memories/delete/app.py, main/server/api/memories/delete/__init__.py, main/server/template.yaml

Type Definitions

RemoveBackendInput {
  existing_codebase: (PR #541 merged state)
}

RemoveBackendOutput {
  api/memories/delete/: directory deleted
  template.yaml: MemoriesDeleteFunction resource and /memories/delete API event removed
  test_delete_memory_api.py: deleted
}

Paths

path-name input output/expected state change path-type notes updated
removeDeleteBackend.success Existing codebase delete/ Lambda directory removed; SAM template MemoriesDeleteFunction resource removed; integration test deleted happy path POST /memories/delete endpoint no longer deployed or reachable Y

3. Pseudocode / Technical Details for Critical Flows (Optional)

Files to delete entirely

main/app/components/memory/memory-delete-menu.tsx
main/app/lib/api/memory/deleteMemory.ts
main/app/__tests__/components/memory-viewer-delete.test.tsx
main/server/api/memories/delete/app.py
main/server/api/memories/delete/__init__.py
main/server/tests/integration/test_delete_memory_api.py

Files to edit

  • main/app/components/memory/memory-viewer-modal.tsx:
  • Remove import MemoryDeleteMenu from "@/components/memory/memory-delete-menu"
  • Remove onMemoryDeleted?: (memoryId: string) => void prop from MemoryViewerModalProps
  • Remove onMemoryDeleteFailed?: (previousData: unknown) => void prop from MemoryViewerModalProps
  • Remove the {onMemoryDeleted && memories[activeIndex] && (<MemoryDeleteMenu ... />)} block from the render output

  • main/app/app/index.tsx:

  • Remove handleMemoryDeleted callback (lines ~207-238)
  • Remove onMemoryDeleted={handleMemoryDeleted} prop from <MemoryViewerModal>
  • Remove any unused imports introduced by the delete feature (ListMemoriesResponse import if only used by handleMemoryDeleted)

  • main/app/lib/api/memory/useMemoryApi.ts:

  • Remove useDeleteMemory export (lines 34-78)
  • Remove import { deleteMemory } from "./deleteMemory" (line 9)
  • Remove useMutation from the @tanstack/react-query import if no longer used

  • main/server/template.yaml:

  • Remove the MemoriesDeleteFunction SAM resource block (lines 663-685)

  • main/app/__tests__/memory-viewer-modal.test.tsx:

  • Remove any test cases that reference onMemoryDeleted, MemoryDeleteMenu, or the delete flow

  • Implementation notes:

  • After removing handleMemoryDeleted from index.tsx, verify that queryClient and refetch imports/usages are still needed for other features before removing them
  • The useQueryClient import in useMemoryApi.ts is only used by useDeleteMemory — remove it along with useDeleteMemory
  • The useMutation import in useMemoryApi.ts is only used by useCreateNewMemory and useDeleteMemory — keep it if useCreateNewMemory remains

After all stages are approved, apply .agent/skills/reconcile-plans/SKILL.md to propagate contract updates across linked plans. - docs/plans/delete-memory-api.md — mark as superseded/removed by this plan