LeoYeAI/agent-master-skills / skills/agent-memory
agent-memory
VerifiedPersistent memory system for AI agents. Remember facts, learn from experience, and track entities across sessions.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 5.5 KB |
| SKILL.md | skill md | 1.5 KB |
| cli/entity.py | script | 3.5 KB |
| cli/fact.py | script | 3.4 KB |
| cli/learn.py | script | 2.3 KB |
| examples/basic_usage.py | script | 2.8 KB |
| requirements.txt | manifest | 48 B |
| src/__init__.py | script | 212 B |
| src/memory.py | script | 21.6 KB |
| tests/test_memory.py | script | 5.1 KB |
examples/basic_usage.py
View on GitHub"""
Basic usage example for AgentMemory
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.memory import AgentMemory
# Initialize memory (creates ~/.agent-memory/memory.db by default)
# Use a temporary path for this example
mem = AgentMemory(db_path="/tmp/agent-memory-example.db")
print("π§ AgentMemory Example\n")
# ==================== FACTS ====================
print("π Storing facts...")
mem.remember(
"Boss prefers brief status updates over long explanations",
tags=["preference", "communication", "boss"]
)
mem.remember(
"API rate limit for the trading service is 100 requests per minute",
tags=["technical", "api", "trading"]
)
mem.remember(
"Weekly standup is every Monday at 9am EST",
tags=["schedule", "meeting"]
)
# ==================== LESSONS ====================
print("π Recording lessons...")
mem.learn(
action="Deployed code directly to production without testing",
context="deployment",
outcome="negative",
insight="Always run the full test suite before deploying, no matter how small the change"
)
mem.learn(
action="Used quarter-Kelly position sizing for trades",
context="trading",
outcome="positive",
insight="Conservative position sizing prevents large drawdowns and allows recovery from bad streaks"
)
# ==================== ENTITIES ====================
print("π€ Tracking entities...")
mem.track_entity("Alex", "person", {
"role": "boss",
"timezone": "America/New_York",
"communication_style": "direct",
"interests": ["AI", "trading", "automation"]
})
mem.track_entity("DataDeck", "project", {
"type": "SaaS",
"status": "completed",
"features": 59,
"url": "https://datadeck-preview.vercel.app"
})
# ==================== RECALL ====================
print("\nπ Recalling memories...\n")
# Search for communication preferences
print("Q: How does boss like updates?")
facts = mem.recall("boss communication updates")
for f in facts[:3]:
print(f" β {f.content}")
print()
# Get negative lessons about deployment
print("Q: What went wrong with deployments?")
lessons = mem.get_lessons(context="deployment", outcome="negative")
for l in lessons:
print(f" β Action: {l.action}")
print(f" Lesson: {l.insight}")
print()
# Get entity info
print("Q: What do I know about Alex?")
alex = mem.get_entity("Alex", "person")
if alex:
print(f" β Name: {alex.name}")
print(f" β Type: {alex.entity_type}")
print(f" β Attributes: {alex.attributes}")
# ==================== STATS ====================
print("\nπ Memory stats:")
stats = mem.stats()
print(f" Active facts: {stats['active_facts']}")
print(f" Lessons: {stats['lessons']}")
print(f" Entities: {stats['entities']}")
print("\nβ
Example complete!")
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why β repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" β or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself β your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |