Skip to content

refactor(core): memory2 for dtop#2004

Merged
aclauer merged 8 commits intodevfrom
andrew/refactor/memory2-for-dtop
May 8, 2026
Merged

refactor(core): memory2 for dtop#2004
aclauer merged 8 commits intodevfrom
andrew/refactor/memory2-for-dtop

Conversation

@aclauer
Copy link
Copy Markdown
Collaborator

@aclauer aclauer commented May 7, 2026

Problem

We want to plot metrics from dtop. Previously I saved the metrics to jsonl files and made a stand alone cli tool for the plotting, but a much better way is to just use memory2.

Closes DIM-XXX

Solution

Add streams for the metrics tracked by dtop and add them to a memory2 Sqlite store. By default, running dtop will not save the metrics. Pass dtop --log to save. It will create a default db at dtop_<date and time>.ignore.db. Then use that as you would normally with memory2.

Minor change: move legend for memory2 plots off of axis so data isn't covered.

Breaking Changes

dtop-plot no longer exists.

How to Test

terminal 1
dimos --replay --dtop run unitree-go2

terminal 2
dtop --log

from dimos.memory2.store.sqlite import SqliteStore
from dimos.memory2.vis.plot.plot import Plot

store = SqliteStore(path="dtop_20260507_122933.ignore.db")
Plot().add(store.stream("GO2Connection_pss"), label="GO2Connection").to_svg("memory.svg")
dtop_20260507_150323 ignore_cpu_percent Produces some nice plots, like this cpu usage on the Orin Nano memory As you can see, the memory usage of Go2 connection in replay has an issue.

Contributor License Agreement

  • I have read and approved the CLA.

@aclauer aclauer changed the title Andrew/refactor/memory2 for dtop refactor(core): memory2 for dtop May 7, 2026
@aclauer aclauer marked this pull request as ready for review May 7, 2026 22:59
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Greptile Summary

Replaces the standalone dtop-plot JSONL-based tool with a memory2 SqliteStore integration inside dtop itself. Running dtop --log now creates a timestamped .ignore.db and records per-role, per-metric streams that can be visualised with the standard Plot API.

  • dtop.py: Swaps log_path/JSON writing for db_path/SqliteStore; streams are keyed by worker_{worker_id}_{metric} and coordinator_{metric}, avoiding the module-name collision issue from the previous JSONL path.
  • dtop_plot.py: Deleted; its [project.scripts] entry has been removed from pyproject.toml as well.
  • svg.py: Legend is moved to bbox_to_anchor=(1.02, 0.5) (outside the axes), and bbox_inches="tight" is added to savefig so the legend is captured in the saved SVG.

Confidence Score: 5/5

Safe to merge. The deleted dtop-plot entry point has been cleanly removed from pyproject.toml, stream naming uses worker_id as the unique key, and the legend/SVG changes are straightforward layout fixes.

All previously flagged issues (stale dtop-plot entry point in pyproject.toml, stream name collision) have been addressed in this revision. The new logging path is well-scoped and only activated with --log, leaving the default TUI behaviour unchanged.

No files require special attention.

Important Files Changed

Filename Overview
dimos/utils/cli/dtop.py Replaces JSONL file logging with memory2 SqliteStore; uses worker_id-keyed stream names and per-metric streams under a LOGGED_METRICS tuple.
dimos/memory2/vis/plot/svg.py Moves legend outside the axes and adds bbox_inches="tight" to savefig so the external legend is captured; no logic errors found.
dimos/utils/cli/dtop_plot.py File deleted; the standalone JSONL plotting tool is replaced by the general-purpose memory2 Plot API.
pyproject.toml Removes the dtop-plot entry point that pointed to the now-deleted module; no stale references remain.

Sequence Diagram

sequenceDiagram
    participant LCM as PickleLCM (bg thread)
    participant App as ResourceSpyApp
    participant Store as SqliteStore
    participant Stream as Stream[float]

    Note over App: dtop --log
    App->>Store: "SqliteStore(path=db_path)"
    App->>Store: start()
    LCM-->>App: _on_msg(msg)
    App->>App: _log_role("coordinator", coord, ts, None)
    App->>App: "_log_role("worker_{id}", worker, ts, modules)"
    loop each metric in LOGGED_METRICS
        App->>Store: stream(name, float)  [once per name]
        Store-->>App: Stream[float]
        App->>Stream: "append(val, ts=ts, tags=tags)"
    end
    Note over App: on_unmount
    App->>Store: stop()
Loading

Reviews (4): Last reviewed commit: "Fix mypy" | Re-trigger Greptile

Comment thread dimos/utils/cli/dtop.py Outdated
Comment thread dimos/utils/cli/dtop.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@aclauer aclauer marked this pull request as draft May 7, 2026 23:53
@aclauer aclauer marked this pull request as ready for review May 8, 2026 00:29
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

Copy link
Copy Markdown
Contributor

@leshy leshy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great, question is how do we analize this data, we have this hacky jupyter notebook thing

md-babel-py run yourfile.md

executes code blocks, produces

https://github.com/dimensionalOS/dimos/blob/dev/docs/capabilities/memory/plot.md

so you can build an analysis, agents are pretty good at this. idk if we should have a template file that people can run, or docs, or realtime rendererr for rerun. memory2 has structures for realtime rerun rendering in place, just didn't write it yet

on where we store,

need to merge #1996
dimos run unitree-go2-memory runs go2 that auto-records all sensors

so it would make sense for dtop also to record into the same db? can see later how

@aclauer aclauer merged commit 28733c3 into dev May 8, 2026
5 checks passed
@aclauer aclauer deleted the andrew/refactor/memory2-for-dtop branch May 8, 2026 04:51
paul-nechifor added a commit that referenced this pull request May 9, 2026
<div align="center"><img width="1000" alt="banner_bordered_trimmed" src="https://github.com/user-attachments/assets/64f13b39-da06-4f58-add0-cfc44f04db4e" /></div>

<div align="center">The Agentive Operating System for Physical Space</div>

<div align="center"><a href="https://discord.gg/dimos">https://discord.gg/dimos</a></div>

# Release v0.0.12: memory2 streaming engine, async modules, OpenArm + G1 low-level, MuJoCo manipulation, slimmer install

## TL;DR

memory2 lands as a typed streaming observation engine. Modules can now be `async def`. Three new robots: OpenArm bimanual, G1 whole-body low-level, Go2 over Unitree SDK2. Manipulation now runs in MuJoCo. The base install drops several hundred MB: perception, sim, and whisper are now opt-in extras.

## Highlights

108 commits, 11 contributors, 972 files changed.

## ⚠️ Breaking Changes

Most breakers are import / config renames. The install shrinkage requires opting into extras you used to get for free.

- Perception (and torch, bitsandbytes) removed from base install — `pip install 'dimos[perception]'` to opt in. ([#1888](#1888))
- Sim removed from base install (~550 MB) — `pip install 'dimos[sim]'`. ([#1878](#1878))
- `faster-whisper` is the default STT — `pip install 'dimos[whisper]'` for full Whisper. ([#1877](#1877))
- `Blueprint.build` removed — use `ModuleCoordinator.build(blueprint)` and import from `dimos.core.coordination`. ([#1744](#1744))
- Module `Config` must be a `pydantic.BaseModel`; module `__init__` signature standardized. ([#1510](#1510))
- `__init__.py` re-exports removed — import directly from defining modules. ([#1545](#1545))
- Blueprint aliases removed — use `MyModule.blueprint()` instead of `my_module()`. ([#1606](#1606))
- Old `Agent` class removed — now agent communication is just through MCP. ([#1657](#1657))
- Teleop blueprints regrouped under `teleop_*`; `VisualizingTeleopModule` removed. ([#1602](#1602))
- Manipulation: joint names use `/` (`arm/joint1`); `WorldStateMonitor` → `RobotStateMonitor`; `_hardware.py` removed in favor of `RobotConfig`. ([#1728](#1728), [#1725](#1725))
- `use_mesh_obstacles` default flipped to `False`; `ObjectDB` no longer matches by name. ([#1656](#1656))

## 🚀 Upgrade

```bash
pip install -U 'dimos[perception,sim,whisper]'
```

Drop extras you don't use.

## ✨ New Features

### memory2

Typed streaming observation engine. memory2 replaces per-blueprint perception buffers with first-class streams that record, query, and visualize together.

- Stream/Observation primitives, SQLite + R*Tree + vec0 backends, codecs, live channels. ([#1536](#1536)) by [@leshy](https://github.com/leshy)
- Recorder/Query modules, semantic search, 3D detection projections, ~10× smaller replay files. ([#1769](#1769)) by [@leshy](https://github.com/leshy)
- StreamModules + Go2 auto-recorder + visualization scaffolding. ([#1682](#1682), [#1925](#1925), [#1637](#1637)) by [@leshy](https://github.com/leshy)

### Async modules & agent API

Modules can now be `async def`. New surface area for scripting and tool-calling agents.

- Async modules: `async def` handlers/RPCs, async `@rpc`, `self.spawn`, latest-only dispatch. ([#1920](#1920)) by [@paul-nechifor](https://github.com/paul-nechifor)
- Porcelain Python API: `connect()` to script against a running DimOS. ([#1779](#1779)) by [@paul-nechifor](https://github.com/paul-nechifor)
- `app.peek_stream(name, timeout)` for one-shot stream samples. ([#1909](#1909)) by [@paul-nechifor](https://github.com/paul-nechifor)
- MCP tool streams: tools push progress back to agents during a single tool call. ([#1713](#1713)) by [@paul-nechifor](https://github.com/paul-nechifor)
- Modules can be restarted at runtime; multiple blueprints can start after startup. ([#1755](#1755), [#1744](#1744)) by [@paul-nechifor](https://github.com/paul-nechifor)
- New patrolling module + `unitree-go2-security` agentic patrol blueprint; patrol rewritten as an async module. ([#1488](#1488), [#1619](#1619), [#1939](#1939)) by [@paul-nechifor](https://github.com/paul-nechifor)
- Blueprint config via CLI `-o key=value`, `__` env vars, and `--config=foo.json`; `--help` lists options. ([#1543](#1543)) by [@Dreamsorcerer](https://github.com/Dreamsorcerer)

### Robot support

- OpenArm bimanual: from-scratch CAN driver, adapter, blueprints, mock + real planner. ([#1897](#1897)) by [@mustafab0](https://github.com/mustafab0)
- G1 humanoid: 500 Hz whole-body low-level coordinator + `unitree-g1-coordinator` blueprint. ([#1954](#1954)) by [@mustafab0](https://github.com/mustafab0)
- Go2 over Unitree SDK2 (`dimos[unitree-dds]`) with Nix-based cyclonedds setup. ([#1885](#1885)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Go2 rage mode (~2.5 m/s) over WebRTC + dedicated keyboard-teleop blueprint. ([#1903](#1903)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Go2 WebRTC TwistAdapter integrated with ControlCoordinator. ([#1362](#1362)) by [@mustafab0](https://github.com/mustafab0)
- `dimos go2tool discover` / `connect-wifi`: find Go2s on LAN or over Bluetooth and configure Wi-Fi without the vendor app. ([#1990](#1990)) by [@leshy](https://github.com/leshy)
- New Hong Kong office Go2 replay datasets. ([#1991](#1991)) by [@leshy](https://github.com/leshy)

### Manipulation in MuJoCo

Any manipulation blueprint can now run in sim with `--simulation`.

```bash
dimos --simulation run coordinator-xarm7
```

- Manipulation in MuJoCo: `--simulation` spins up a sim arm; coordinator and teleop blueprints (xArm6/xArm7/Piper) honor the flag, replacing per-arm sim blueprints. ([#1639](#1639), [#2027](#2027)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Quest teleop in MuJoCo for xArm6 + Piper, with eye-in-hand sim cameras. ([#1958](#1958)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Sim assets for xArm6 and Piper + `MujocoCamera` (drop-in RealSense replacement in sim). ([#1642](#1642), [#1694](#1694)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Unified `RobotConfig`: parse joints/DOF/limits from URDF/MJCF instead of hand-wiring. ([#1699](#1699)) by [@mustafab0](https://github.com/mustafab0)
- Drake loader supports MJCF; configured home pose + EE orientation honored when planning. ([#1722](#1722)) by [@mustafab0](https://github.com/mustafab0)
- Manipulation demo: `look`/`drop_on` skills, distance-adaptive grasps, structured agent prompt. ([#1656](#1656)) by [@mustafab0](https://github.com/mustafab0)
- Control blueprints split into a package; hardcoded IPs replaced with env vars (`XARM7_IP`, …). ([#1601](#1601)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Unity simulator as a DimOS module (`dimos run unity-sim`); auto-downloads on Linux x86. ([#1539](#1539)) by [@jeff-hykin](https://github.com/jeff-hykin)

### Core & visualizer

- Rust native modules: write performance-critical modules in Rust (LCM transport, `NativeModule` API). ([#1794](#1794)) by [@aclauer](https://github.com/aclauer)
- Watchdog kills all DimOS child processes (and grandchildren) when the parent exits. ([#1886](#1886)) by [@paul-nechifor](https://github.com/paul-nechifor)
- DockerModules restored: parallel deploy, image pull, build args, rebuild on Dockerfile change. ([#1431](#1431)) by [@jeff-hykin](https://github.com/jeff-hykin)
- Voxel maps render as Rerun Points3D spheres (~10× faster at high point counts). ([#1793](#1793)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Rerun pipeline latency: PointCloud2 ~350 ms → ~5 ms; costmap ~40 ms → ~5 ms. ([#1747](#1747)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Blueprint module dependency graph auto-rendered as a Graph tab in Rerun. ([#1705](#1705)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Viewer remote `--connect` works again — clicks/teleop flow over websockets. ([#1784](#1784)) by [@jeff-hykin](https://github.com/jeff-hykin)
- `dtop` shows native child-process CPU; `dtop --log` records metrics to a memory2 SQLite store for offline plotting. ([#1880](#1880), [#2004](#2004)) by [@aclauer](https://github.com/aclauer)

## 🐛 Bug Fixes

- macOS UDP receive buffer probed up to 32 MiB. ([#1789](#1789)) by [@Dreamsorcerer](https://github.com/Dreamsorcerer)
- `--disable` works again; module-by-name lookup fixed. ([#1707](#1707), [#1689](#1689)) by [@paul-nechifor](https://github.com/paul-nechifor)
- `CameraModule.stop()` reachable via RPC; doc imports use canonical paths. ([#1773](#1773)) by [@jeff-hykin](https://github.com/jeff-hykin)
- Python 3.10 compat (`typing_extensions.Self`); skip `pyrealsense2` on macOS; fix `nix develop` LCM build on macOS. ([#1621](#1621), [#1556](#1556), [#1610](#1610)) by [@jeff-hykin](https://github.com/jeff-hykin)
- Rerun grid raised above the costmap; viewer bumped to 0.30.0a6. ([#1714](#1714), [#1690](#1690), [#1785](#1785)) by [@ruthwikdasyam](https://github.com/ruthwikdasyam)
- Go2 lidar timestamps repaired: non-monotonic frames clamped to the expected period; older firmware that never updates timestamps falls back to system time after a calibration window. ([#1992](#1992), [#2021](#2021)) by [@leshy](https://github.com/leshy), [@aclauer](https://github.com/aclauer)
- Replay memory leak fixed. ([#2025](#2025)) by [@leshy](https://github.com/leshy)

## ⚡ Performance

- `dimos --help` ~5 s → ~2 s by trimming heavy imports and deferring `o3dpickle`. ([#1571](#1571), [#1721](#1721)) by [@jeff-hykin](https://github.com/jeff-hykin), [@Dreamsorcerer](https://github.com/Dreamsorcerer)

## 🔒 Security

- MCP/Foxglove/GStreamer bind to localhost by default; set `MCP_HOST=0.0.0.0` to expose. ([#1698](#1698)) by [@vrinek](https://github.com/vrinek)
- Update vulnerable dependencies flagged by Dependabot. ([#1989](#1989)) by [@paul-nechifor](https://github.com/paul-nechifor)

## 👥 New Contributors

- [@aclauer](https://github.com/aclauer) made his first contribution in [#1794](#1794)
- [@vrinek](https://github.com/vrinek) made his first contribution in [#1698](#1698)

**Full Changelog**: v0.0.11...v0.0.12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants