Skip to content

Conversation

@ClaireBookworm
Copy link
Contributor

  • added support for renaming entities, enabling a video example for showing graph
  • showing graph_viz_server, to show a way to see the graphed relationships between entiites

@greptile-apps
Copy link

greptile-apps bot commented Jan 25, 2026

Greptile Overview

Greptile Summary

This PR adds entity renaming capabilities and visualization tools to the temporal memory system. The main additions include:

  • Entity Renaming: New rename_entity() RPC method allows updating entity descriptors and metadata. The VLM can automatically extract rename commands from user queries using regex pattern matching (RENAME_ENTITY: entity_id="..." new_name="...").
  • Graph Visualization Server: New Flask-based web server (graph_viz_server.py) provides real-time visualization of entity graphs using vis.js, with interactive controls for relations, distances, and time information.
  • Video Example: New example script demonstrating temporal memory usage with video files, including a query endpoint on port 8081.
  • Rerun Integration: Added Rerun visualization support with camera view blueprints and image logging.
  • G1 Blueprint Integration: Temporal memory now included in full_featured blueprint with clear_memory_on_start=True.

The implementation correctly uses parameterized SQL queries to prevent injection attacks in update_entity(). The Flask visualization server appropriately binds to 127.0.0.1 for localhost-only access. Previous review comments about module-level imports have been addressed - re and time modules are now imported at the top level.

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations for testing
  • The code is well-structured with proper security practices (parameterized SQL, localhost binding). Previous review comments have been addressed. Score of 4 reflects that this is experimental code adding significant new functionality that would benefit from thorough testing, particularly the regex-based rename extraction and the interaction between VLM responses and the rename system.
  • Focus testing on temporal_memory.py rename logic and the regex pattern matching for RENAME_ENTITY commands to ensure it handles edge cases properly

Important Files Changed

Filename Overview
dimos/perception/experimental/temporal_memory/entity_graph_db.py Added update_entity method for renaming/updating entities; SQL injection safe via parameterized query
dimos/perception/experimental/temporal_memory/graph_viz_server.py New Flask-based visualization server for entity graphs; binds to localhost only
dimos/perception/experimental/temporal_memory/video_temporal_example.py New example demonstrating temporal memory with video files and query endpoints
dimos/perception/experimental/temporal_memory/temporal_memory.py Added rename_entity RPC method, query-based renaming via regex, Rerun integration, and view blueprints

Sequence Diagram

sequenceDiagram
    participant User
    participant TemporalMemory
    participant VLM
    participant EntityGraphDB
    participant FlaskViz
    
    Note over TemporalMemory,EntityGraphDB: Entity Renaming Flow
    
    User->>TemporalMemory: query("rename person in brown jacket to john")
    TemporalMemory->>TemporalMemory: Build prompt with rename instructions
    TemporalMemory->>VLM: query(frame, prompt)
    VLM-->>TemporalMemory: Response with RENAME_ENTITY command
    TemporalMemory->>TemporalMemory: Extract rename via regex pattern
    TemporalMemory->>TemporalMemory: rename_entity(entity_id="E8", new_name="john")
    TemporalMemory->>EntityGraphDB: get_entity(entity_id)
    EntityGraphDB-->>TemporalMemory: entity data
    TemporalMemory->>TemporalMemory: Build new descriptor: "john (person wearing brown jacket)"
    TemporalMemory->>EntityGraphDB: update_entity(entity_id, descriptor, metadata)
    EntityGraphDB->>EntityGraphDB: Merge metadata with existing
    EntityGraphDB->>EntityGraphDB: Execute SQL UPDATE with params
    EntityGraphDB-->>TemporalMemory: Success
    TemporalMemory->>TemporalMemory: Update entity roster in state
    TemporalMemory->>TemporalMemory: Remove RENAME_ENTITY from response
    TemporalMemory-->>User: Cleaned response text
    
    Note over FlaskViz,EntityGraphDB: Visualization Flow
    
    FlaskViz->>FlaskViz: Poll /api/graph every 1s
    FlaskViz->>EntityGraphDB: get_all_entities()
    EntityGraphDB-->>FlaskViz: entities list
    FlaskViz->>EntityGraphDB: get_recent_relations()
    EntityGraphDB-->>FlaskViz: relations list
    FlaskViz->>EntityGraphDB: get_distance(e1, e2) for all pairs
    EntityGraphDB-->>FlaskViz: distance data
    FlaskViz->>FlaskViz: Render graph with vis.js
    FlaskViz-->>User: Display updated entity names
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

answer_text = answer_text.strip()

# Check for rename commands in the response
import re
Copy link

Choose a reason for hiding this comment

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

re module imported inside method instead of at module level - move to top imports for better performance

print("🌐 Open http://localhost:8080 in your browser")
print("Press Ctrl+C to stop")

app.run(host="0.0.0.0", port=8080, debug=False, threaded=True)
Copy link

Choose a reason for hiding this comment

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

Flask server binds to 0.0.0.0 making it accessible from any network interface - this could expose the temporal memory database to unauthorized access. Consider binding to 127.0.0.1 for localhost-only access unless external access is specifically required.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

3 participants