Implement persistent memory and enriched user context for agent#608
Merged
Conversation
Memory package (memory/memory.go): Per-user key-value store that persists across sessions. The agent remembers preferences, interests, and facts the user shares. Stored in memory.json, capped at 50 entries per user. API: Set, Get, All, Delete, Clear, ForContext (formatted for prompt injection). Cleared on account deletion. Memory extraction: After each agent query, extractMemory checks if the user's prompt contains something to remember (triggered by keywords like "remember", "I like", "I prefer", "I live in"). If detected, a background LLM call (BackgroundModel) extracts a key-value pair and saves it. Next query, the agent sees it in its context. Enriched user context: The agent's synthesis prompt now includes: - Unread mail count - Wallet balance - Market prices (BTC, ETH, SOL, GOLD, OIL with 24h change) - All saved memories markets.TopMovers(n) returns a compact string of top tracked assets with prices and 24h changes. The agent introduces itself as "Micro, a personal AI assistant" and has genuine awareness of the user's state — mail, money, markets, and what they've told it to remember. https://claude.ai/code/session_01GRGLA9yj7BpqKiyi6xFwnm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.