Skip to content

LeoYeAI/agent-master-skills / skills/agent-memory

agent-memory

Verified

Persistent memory system for AI agents. Remember facts, learn from experience, and track entities across sessions.

FileKindSize
README.mdmarkdown5.5 KB
SKILL.mdskill md1.5 KB
cli/entity.pyscript3.5 KB
cli/fact.pyscript3.4 KB
cli/learn.pyscript2.3 KB
examples/basic_usage.pyscript2.8 KB
requirements.txtmanifest48 B
src/__init__.pyscript212 B
src/memory.pyscript21.6 KB
tests/test_memory.pyscript5.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!")
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall