Slot Memory System
Overview
The UPlanet IA system now supports a multi-user, multi-slot memory system that allows users to organize their conversation history into 13 different memory slots (0-12).
Features
Multi-user support: Each user (identified by nostr email or pubkey) has their own memory slots
13 memory slots: Slots 0-12 for organizing different conversation contexts
Automatic slot detection: Detects
#1-#12tags in messagesBackward compatibility: Maintains legacy memory system for existing users
Usage
Recording Memory
To record a message in a specific memory slot, use the #rec tag with a slot number:
#rec #3 This message will be stored in slot 3
#rec #7 Another message in slot 7
#rec This message will be stored in slot 0 (default)Using Memory for IA Context
When asking the IA a question, specify which slot to use for context:
Viewing Memory
To view the contents of a specific memory slot:
Resetting Memory
To reset a specific memory slot:
Important: The reset functionality only affects memory files stored in $HOME/.zen/tmp/flashmem/{user_id}/slot{N}.json. It does not affect legacy memory files in ~/.zen/tmp/flashmem/uplanet_memory/.
File Structure
Memory files are stored in the following structure:
Memory File Format
Each slot memory file contains:
Implementation Details
Updated Files
NIP-101/relay.writePolicy.plugin/filter/1.shDetects
#1-#12tags when#recis presentCalls
short_memory.pywith slot number and user ID
Astroport.ONE/IA/short_memory.pyAccepts slot number and user ID parameters
Stores memory in user-specific slot files
Maintains backward compatibility with legacy system
Astroport.ONE/IA/UPlanet_IA_Responder.shDetects slot numbers in
#BRO/#BOTmessagesUpdates
#memand#resetto support slot selectionPasses slot and user ID to
question.py
Astroport.ONE/IA/question.pyAdded
--slotand--user-idparametersLoads context from slot-based memory files
Falls back to legacy memory system if needed
Slot Detection Logic
Default slot: 0 (when no
#1-#12tag is found)User identification: Uses KNAME (nostr email) if available, falls back to pubkey
Tag parsing: Searches for
#1through#12in message content
Memory Limits
Per slot: Last 50 messages
Context for IA: Last 20 messages (to avoid token limits)
Testing
Run the test script to verify the implementation:
Migration
Existing users will continue to work with the legacy memory system. New slot-based memory will be created alongside existing memory files.
Examples
Example 1: Work-related conversations
Example 2: Personal conversations
Example 3: Project discussions
Troubleshooting
Memory not found: Check if the user ID and slot number are correct
Legacy memory: Old memory files are still accessible via pubkey-based queries
Slot limits: Only slots 0-12 are supported
File permissions: Ensure write permissions to
~/.zen/tmp/flashmem/
Last updated