Skip to main content

Robot Memory - Persistent memory system for robotic AI agents

Project description

中文版

robotmem — Let Robots Learn from Experience

Your robot ran 1000 experiments, starting from scratch every time. robotmem stores episode experiences — parameters, trajectories, outcomes — and retrieves the most relevant ones to guide future decisions.

FetchPush experiment: +25% success rate improvement (42% → 67%), CPU-only, reproducible in 5 minutes.

robotmem 30s demo: save → restart → recall

Quick Start

pip install robotmem
from robotmem import learn, recall, save_perception, start_session, end_session

# Start an episode
session = start_session(context='{"robot_id": "arm-01", "task": "push"}')

# Record experience
learn(
    insight="grip_force=12.5N yields highest grasp success rate",
    context='{"params": {"grip_force": {"value": 12.5, "unit": "N"}}, "task": {"success": true}}'
)

# Retrieve experiences (structured filtering + spatial nearest-neighbor)
memories = recall(
    query="grip force parameters",
    context_filter='{"task.success": true}',
    spatial_sort='{"field": "spatial.position", "target": [1.3, 0.7, 0.42]}'
)

# Store perception data
save_perception(
    description="Grasp trajectory: 30 steps, success",
    perception_type="procedural",
    data='{"sampled_actions": [[0.1, -0.3, 0.05, 0.8], ...]}'
)

# End episode (auto-consolidation + proactive recall)
end_session(session_id=session["session_id"])

7 APIs

API Purpose
learn Record physical experiences (parameters / strategies / lessons)
recall Retrieve experiences — BM25 + vector hybrid search with context_filter and spatial_sort
save_perception Store perception / trajectory / force data (visual / tactile / proprioceptive / auditory / procedural)
forget Delete incorrect memories
update Correct memory content
start_session Begin an episode
end_session End an episode (auto-consolidation + proactive recall)

Key Features

Structured Experience Retrieval

Not just vector search — robotmem understands the structure of robot experiences:

# Retrieve only successful experiences
recall(query="push to target", context_filter='{"task.success": true}')

# Find spatially nearest scenarios
recall(query="grasp object", spatial_sort='{"field": "spatial.object_position", "target": [1.3, 0.7, 0.42]}')

# Combine: success + distance < 0.05m
recall(
    query="push",
    context_filter='{"task.success": true, "params.final_distance.value": {"$lt": 0.05}}'
)

Context JSON — 4 Sections

{
    "params":  {"grip_force": {"value": 12.5, "unit": "N", "type": "scalar"}},
    "spatial": {"object_position": [1.3, 0.7, 0.42], "target_position": [1.25, 0.6, 0.42]},
    "robot":   {"id": "fetch-001", "type": "Fetch", "dof": 7},
    "task":    {"name": "push_to_target", "success": true, "steps": 38}
}

Each recalled memory automatically extracts params / spatial / robot / task as top-level fields.

Memory Consolidation + Proactive Recall

end_session automatically triggers:

  • Consolidation: Merges similar memories with Jaccard similarity > 0.50 (protects constraint / postmortem / high-confidence entries)
  • Proactive Recall: Returns historically relevant memories for the next episode

FetchPush Demo

cd examples/fetch_push
pip install gymnasium-robotics
PYTHONPATH=../../src python demo.py  # 90 episodes, ~2 min

Three-phase experiment: baseline → memory writing → memory utilization. Expected Phase C success rate 10-20% higher than Phase A.

Architecture

SQLite + FTS5 + vec0
├── BM25 full-text search (jieba CJK tokenizer)
├── Vector search (FastEmbed ONNX, CPU-only)
├── RRF fusion ranking
├── Structured filtering (context_filter)
└── Spatial nearest-neighbor sorting (spatial_sort)
  • CPU-only, no GPU required
  • Single-file database ~/.robotmem/memory.db
  • MCP Server (7 tools) or direct Python import
  • Web management UI: robotmem web

Comparison

Feature MemoryVLA (Academic) Mem0 (Product) robotmem
Target users Specific VLA models Text AI Robotic AI
Memory format Vectors (opaque) Text Natural language + perception + parameters
Structured filtering No No Yes (context_filter)
Spatial retrieval No No Yes (spatial_sort)
Physical parameters No No Yes (params section)
Installation Compile from paper code pip install pip install
Database Embedded Cloud Local SQLite

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotmem-0.1.3.tar.gz (134.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotmem-0.1.3-py3-none-any.whl (94.7 kB view details)

Uploaded Python 3

File details

Details for the file robotmem-0.1.3.tar.gz.

File metadata

  • Download URL: robotmem-0.1.3.tar.gz
  • Upload date:
  • Size: 134.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for robotmem-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b1b71e857f5483d4276a7cb2cc807f41a4c77f0b90e4df82ae7af9dff2045295
MD5 948cee026f02e2d3f5ca1589d182e7e4
BLAKE2b-256 5da20f44412ca31befba3369a3e40c52a0c70475e08578733c966f949cfe5139

See more details on using hashes here.

File details

Details for the file robotmem-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: robotmem-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 94.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for robotmem-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3a246962fdeb94173c0fbd02f7b6b215835f0c7c3b08c538f41138dcf696bc8d
MD5 21200e463812a42733b3020095d9734d
BLAKE2b-256 a041250b9d6ee56a44804004d1a514ae74925758584ab67063c50f36c9de707d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page