# dataojitori/nocturne_memory architecture

> Architecture diagram of the GitHub repository dataojitori/nocturne_memory, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dataojitori/nocturne_memory
- Repository: https://github.com/dataojitori/nocturne_memory

## Overview

Nocturne Memory is an MCP long-term-memory server with a browser dashboard. Agents use MCP tools to create, read, search, and update namespaced memories; the backend persists and indexes them, while people browse memories and audit or manage changes in the dashboard. The repository also includes heartbeat integrations. The graph uses README claims and indexed imports as evidence; several domain modules are indexed but not excerpted, so their internal call paths are left unspecified.

Main entry points: [`backend/web_app.py`](https://github.com/dataojitori/nocturne_memory/blob/main/backend/web_app.py) (Web API), [`backend/mcp_server.py`](https://github.com/dataojitori/nocturne_memory/blob/main/backend/mcp_server.py) (MCP tools), [`frontend/src/lib/api.js`](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/lib/api.js) (Dashboard API client), [`frontend/src/App.jsx`](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/App.jsx) (Dashboard shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent interface"]
  node_mcp_server["MCP tools<br/>[mcp_server.py]"]
  node_system_views["Boot views<br/>[system_views.py]"]
  node_web_app["Web API<br/>[web_app.py]"]
  node_api_browse["Browse endpoints<br/>[browse.py]"]
  node_api_review["Review endpoints<br/>[review.py]"]
  node_api_settings["Settings endpoints<br/>[settings.py]"]
end

subgraph group_memory["Memory services"]
  node_graph_service["Memory graph<br/>[graph.py]"]
  node_search_service["Search index<br/>[search.py]"]
  node_glossary_service["Glossary<br/>[glossary.py]"]
  node_preset_service["Presets<br/>[presets.py]"]
  node_snapshot_store[("Change snapshots<br/>[snapshot.py]")]
  node_db_manager[("Database manager<br/>[database.py]")]
  node_db_models["Memory models<br/>[models.py]"]
  node_namespace["Namespace context<br/>[namespace.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_api_client["Dashboard API client<br/>[api.js]"]
  node_dashboard_app["Dashboard shell<br/>[App.jsx]"]
  node_memory_browser["Memory explorer<br/>[MemoryBrowser.jsx]"]
  node_review_ui["Review and audit<br/>[ReviewPage.jsx]"]
  node_maintenance_ui["Maintenance"]
  node_settings_ui["Settings<br/>[SettingsDrawer.jsx]"]
end

subgraph group_operations["Operations"]
  node_config["Configuration<br/>[config.py]"]
  node_auth["Bearer authentication<br/>[auth.py]"]
  node_heartbeat["Heartbeat engine"]
  node_heartbeat_clients["Heartbeat integrations"]
end

node_mcp_client(("MCP client"))

node_mcp_client -->|"calls tools"| node_mcp_server
node_mcp_server -->|"reads and writes"| node_graph_service
node_mcp_server -->|"uses views"| node_system_views
node_mcp_server -->|"starts dashboard"| node_web_app
node_mcp_server -->|"records changes"| node_snapshot_store
node_web_app -->|"routes to"| node_api_browse
node_web_app -->|"routes to"| node_api_review
node_web_app -->|"routes to"| node_api_settings
node_web_app -->|"configures auth"| node_auth
node_api_browse -->|"uses services"| node_graph_service
node_api_browse -->|"uses context"| node_namespace
node_api_review -->|"reads changes"| node_snapshot_store
node_api_settings -->|"uses context"| node_namespace
node_graph_service -.->|"persists through"| node_db_manager
node_search_service -->|"indexes through"| node_db_manager
node_db_manager -->|"creates schema"| node_db_models
node_dashboard_app -->|"renders"| node_memory_browser
node_dashboard_app -->|"renders"| node_review_ui
node_dashboard_app -->|"renders"| node_maintenance_ui
node_dashboard_app -->|"renders"| node_settings_ui
node_memory_browser -->|"requests data"| node_api_client
node_review_ui -->|"requests review"| node_api_client
node_maintenance_ui -->|"requests actions"| node_api_client
node_settings_ui -.->|"requests settings"| node_api_client
node_api_client -.->|"HTTP requests"| node_web_app
node_config -->|"configures database"| node_db_manager
node_heartbeat_clients -->|"uses engine"| node_heartbeat

click node_mcp_server "https://github.com/dataojitori/nocturne_memory/blob/main/backend/mcp_server.py"
click node_system_views "https://github.com/dataojitori/nocturne_memory/blob/main/backend/system_views.py"
click node_web_app "https://github.com/dataojitori/nocturne_memory/blob/main/backend/web_app.py"
click node_api_client "https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/lib/api.js"
click node_dashboard_app "https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/App.jsx"
click node_memory_browser "https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/memory/MemoryBrowser.jsx"
click node_review_ui "https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/review/ReviewPage.jsx"
click node_maintenance_ui "https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/maintenance/MaintenancePage.jsx"
click node_settings_ui "https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/settings/SettingsDrawer.jsx"
click node_api_browse "https://github.com/dataojitori/nocturne_memory/blob/main/backend/api/browse.py"
click node_api_review "https://github.com/dataojitori/nocturne_memory/blob/main/backend/api/review.py"
click node_api_settings "https://github.com/dataojitori/nocturne_memory/blob/main/backend/api/settings.py"
click node_graph_service "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/graph.py"
click node_search_service "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/search.py"
click node_glossary_service "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/glossary.py"
click node_preset_service "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/presets.py"
click node_snapshot_store "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/snapshot.py"
click node_db_manager "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/database.py"
click node_db_models "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/models.py"
click node_namespace "https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/namespace.py"
click node_config "https://github.com/dataojitori/nocturne_memory/blob/main/backend/config.py"
click node_auth "https://github.com/dataojitori/nocturne_memory/blob/main/backend/auth.py"
click node_heartbeat "https://github.com/dataojitori/nocturne_memory/blob/main/desktop_pet/heartbeat_engine.py"
click node_heartbeat_clients "https://github.com/dataojitori/nocturne_memory/blob/main/desktop_pet/antigravity_heartbeat.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp_server,node_system_views,node_web_app,node_api_browse,node_api_review,node_api_settings,node_mcp_client toneBlue
class node_graph_service,node_search_service,node_glossary_service,node_preset_service,node_snapshot_store,node_db_manager,node_db_models,node_namespace toneAmber
class node_api_client,node_dashboard_app,node_memory_browser,node_review_ui,node_maintenance_ui,node_settings_ui toneMint
class node_config,node_auth,node_heartbeat,node_heartbeat_clients toneRose
```

## Components

### Agent interface

- [MCP tools](https://github.com/dataojitori/nocturne_memory/blob/main/backend/mcp_server.py): `backend/mcp_server.py`
- [Boot views](https://github.com/dataojitori/nocturne_memory/blob/main/backend/system_views.py): `backend/system_views.py`
- [Web API](https://github.com/dataojitori/nocturne_memory/blob/main/backend/web_app.py): `backend/web_app.py`
- [Browse endpoints](https://github.com/dataojitori/nocturne_memory/blob/main/backend/api/browse.py): `backend/api/browse.py`
- [Review endpoints](https://github.com/dataojitori/nocturne_memory/blob/main/backend/api/review.py): `backend/api/review.py`
- [Settings endpoints](https://github.com/dataojitori/nocturne_memory/blob/main/backend/api/settings.py): `backend/api/settings.py`

### Memory services

- [Memory graph](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/graph.py): `backend/db/graph.py`
- [Search index](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/search.py): `backend/db/search.py`
- [Glossary](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/glossary.py): `backend/db/glossary.py`
- [Presets](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/presets.py): `backend/db/presets.py`
- [Change snapshots](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/snapshot.py): `backend/db/snapshot.py`
- [Database manager](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/database.py): `backend/db/database.py`
- [Memory models](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/models.py): `backend/db/models.py`
- [Namespace context](https://github.com/dataojitori/nocturne_memory/blob/main/backend/db/namespace.py): `backend/db/namespace.py`

### Dashboard

- [Dashboard API client](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [Dashboard shell](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Memory explorer](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/memory/MemoryBrowser.jsx): `frontend/src/features/memory/MemoryBrowser.jsx`
- [Review and audit](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/review/ReviewPage.jsx): `frontend/src/features/review/ReviewPage.jsx`
- [Maintenance](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/maintenance/MaintenancePage.jsx): `frontend/src/features/maintenance/MaintenancePage.jsx`
- [Settings](https://github.com/dataojitori/nocturne_memory/blob/main/frontend/src/features/settings/SettingsDrawer.jsx): `frontend/src/features/settings/SettingsDrawer.jsx`

### Operations

- [Configuration](https://github.com/dataojitori/nocturne_memory/blob/main/backend/config.py): `backend/config.py`
- [Bearer authentication](https://github.com/dataojitori/nocturne_memory/blob/main/backend/auth.py): `backend/auth.py`
- [Heartbeat engine](https://github.com/dataojitori/nocturne_memory/blob/main/desktop_pet/heartbeat_engine.py): `desktop_pet/heartbeat_engine.py`
- [Heartbeat integrations](https://github.com/dataojitori/nocturne_memory/blob/main/desktop_pet/antigravity_heartbeat.py): `desktop_pet/antigravity_heartbeat.py`

### Other components

- **MCP client**

## Connections

- MCP client → MCP tools: calls tools (evidence: `README.md`)
- MCP tools → Memory graph: reads and writes (evidence: `backend/mcp_server.py`)
- MCP tools → Boot views: uses views (evidence: `backend/mcp_server.py`)
- MCP tools → Web API: starts dashboard (evidence: `backend/mcp_server.py`)
- MCP tools → Change snapshots: records changes (evidence: `backend/mcp_server.py`)
- Web API → Browse endpoints: routes to (evidence: `backend/web_app.py`)
- Web API → Review endpoints: routes to (evidence: `backend/web_app.py`)
- Web API → Settings endpoints: routes to (evidence: `backend/web_app.py`)
- Web API → Bearer authentication: configures auth (evidence: `backend/web_app.py`)
- Browse endpoints → Memory graph: uses services (evidence: `backend/api/browse.py`)
- Browse endpoints → Namespace context: uses context (evidence: `backend/api/browse.py`)
- Review endpoints → Change snapshots: reads changes (evidence: `backend/api/review.py`)
- Settings endpoints → Namespace context: uses context (evidence: `backend/api/settings.py`)
- Memory graph → Database manager: persists through
- Search index → Database manager: indexes through (evidence: `backend/db/search.py`)
- Database manager → Memory models: creates schema (evidence: `backend/db/database.py`)
- Dashboard shell → Memory explorer: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Review and audit: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Maintenance: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Settings: renders (evidence: `frontend/src/App.jsx`)
- Memory explorer → Dashboard API client: requests data (evidence: `frontend/src/features/memory/MemoryBrowser.jsx`)
- Review and audit → Dashboard API client: requests review (evidence: `frontend/src/features/review/ReviewPage.jsx`)
- Maintenance → Dashboard API client: requests actions (evidence: `frontend/src/features/maintenance/MaintenancePage.jsx`)
- Settings → Dashboard API client: requests settings
- Dashboard API client → Web API: HTTP requests
- Configuration → Database manager: configures database (evidence: `backend/db/__init__.py`)
- Heartbeat integrations → Heartbeat engine: uses engine (evidence: `desktop_pet/antigravity_heartbeat.py`)
