a digital person for bluesky
1"""Flag archival memory for deletion tool."""
2from pydantic import BaseModel, Field
3
4
5class FlagArchivalMemoryForDeletionArgs(BaseModel):
6 reason: str = Field(
7 ...,
8 description="The reason why this memory should be deleted"
9 )
10 memory_text: str = Field(
11 ...,
12 description="The exact text content of the archival memory to delete"
13 )
14 confirm: bool = Field(
15 ...,
16 description="Confirmation that you want to delete this memory (must be true to proceed)"
17 )
18
19
20def flag_archival_memory_for_deletion(reason: str, memory_text: str, confirm: bool) -> str:
21 """
22 Flag an archival memory for deletion based on its exact text content.
23
24 This is a "dummy" tool that doesn't directly delete memories but signals to the system
25 that the specified memory should be deleted at the end of the turn (if no halt_activity
26 has been received).
27
28 The system will search for all archival memories with this exact text and delete them.
29
30 IMPORTANT: If multiple archival memories have identical text, ALL of them will be deleted.
31 Make sure the memory_text is unique enough to avoid unintended deletions.
32
33 Args:
34 reason: The reason why this memory should be deleted
35 memory_text: The exact text content of the archival memory to delete
36 confirm: Confirmation that you want to delete this memory (must be true)
37
38 Returns:
39 Confirmation message
40 """
41 # This is a dummy tool - it just returns a confirmation
42 # The actual deletion will be handled by the bot loop after the agent's turn completes
43 if not confirm:
44 return "Deletion cancelled - confirm must be set to true to delete the memory."
45
46 return f"Memory flagged for deletion (reason: {reason}). Will be removed at the end of this turn if no halt is received."