# graphadvantage/neo4j-relate-context architecture

> Architecture diagram of the GitHub repository graphadvantage/neo4j-relate-context, 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/graphadvantage/neo4j-relate-context
- Repository: https://github.com/graphadvantage/neo4j-relate-context
- Video tour (about a minute): https://gitdiagram.com/graphadvantage/neo4j-relate-context/video

## Overview

neo4j-relate-context is a federated agent-memory system: host-side taps and memory MCP connectors capture work into local per-agent Relate graphs, while a console manages capture, replication, recall, metrics, and a live topology/query UI. The principal workflow is agent activity → capture → local persistence → asynchronous Aura replication → scoped recall and evidence. Separate Chat and Code recall paths preserve their different scopes and search methods. The README documents the deployment flows; some subsystem links below are documented rather than verified in sampled implementation excerpts.

Main entry points: [`relate_tap/server.py`](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/server.py) (Console API), [`memory_graph.py`](https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_graph.py) (Agent Relate graphs), [`relate_tap/tap.py`](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/tap.py) (Host tap), [`memory_mcp.py`](https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_mcp.py) (Memory MCP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture paths"]
  node_host_tap["Host tap<br/>[tap.py]"]
  node_turn_capture["Turn capture<br/>[memory_graph.py]"]
end

subgraph group_memory["Memory and recall"]
  node_memory_mcp["Memory MCP<br/>[memory_mcp.py]"]
  node_chat_intents["Chat intent recall<br/>[intent_recall.py]"]
  node_coding_recall["Coding recall<br/>[coding_recall.py]"]
  node_recall_client["Recall client<br/>[recall_client.py]"]
  node_query_evidence["Query evidence<br/>[reuse_evidence.py]"]
end

subgraph group_runtime["Console and storage"]
  node_capture_api["Capture API<br/>[routes.py]"]
  node_spool[("Capture spool<br/>[remote_capture.py]")]
  node_collector["Spool collector<br/>[server.py]"]
  node_capture_store[("Capture store<br/>[store.py]")]
  node_local_graphs[("Agent Relate graphs<br/>[memory_graph.py]")]
  node_aura_sync["Aura replication<br/>[aura_sync.py]"]
  node_aura[("Shared Aura graph")]
  node_console_api["Console API<br/>[server.py]"]
  node_routes["HTTP routes<br/>[routes.py]"]
  node_metrics["Capture and recall metrics<br/>[cowork_metrics.py]"]
  node_query_sources["Graph query sources<br/>[sources.py]"]
end

subgraph group_frontend["Console interface"]
  node_topology_ui["Topology view<br/>[Topology.tsx]"]
  node_topology_model["Topology model<br/>[topology-model.ts]"]
  node_playground["Query playground<br/>[App.tsx]"]
  node_recall_chyron["Recall chyron<br/>[RecallChyron.tsx]"]
end

node_agents(("Agents"))
node_domain_mcp["Domain MCP"]

node_agents -->|"MCP traffic"| node_host_tap
node_host_tap -->|"forwards traffic"| node_domain_mcp
node_host_tap -->|"sends redacted copies"| node_capture_api
node_capture_api -->|"ingests events"| node_spool
node_spool -->|"queues events"| node_collector
node_collector -.->|"persists events"| node_capture_store
node_agents -->|"calls memory tools"| node_memory_mcp
node_memory_mcp -->|"records turns"| node_local_graphs
node_agents -->|"reports turns"| node_turn_capture
node_turn_capture -->|"stores evidence"| node_local_graphs
node_local_graphs -->|"snapshots graph"| node_aura_sync
node_aura_sync -->|"pushes snapshots"| node_aura
node_memory_mcp -->|"requests recall"| node_recall_client
node_recall_client -->|"posts operation"| node_console_api
node_console_api -.->|"registers routes"| node_routes
node_routes -->|"dispatches recall"| node_chat_intents
node_routes -.->|"dispatches recall"| node_coding_recall
node_chat_intents -->|"uses evidence"| node_query_evidence
node_coding_recall -->|"searches turns"| node_local_graphs
node_chat_intents -->|"promotes intents"| node_aura
node_console_api -.->|"serves metrics"| node_metrics
node_topology_ui -->|"reads topology"| node_console_api
node_topology_ui -->|"renders model"| node_topology_model
node_playground -->|"runs queries"| node_query_sources
node_recall_chyron -->|"uses recall state"| node_topology_model

click node_host_tap "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/tap.py"
click node_capture_api "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/routes.py"
click node_spool "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/remote_capture.py"
click node_collector "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/server.py"
click node_capture_store "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/store.py"
click node_turn_capture "https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_graph.py"
click node_memory_mcp "https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_mcp.py"
click node_local_graphs "https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_graph.py"
click node_aura_sync "https://github.com/graphadvantage/neo4j-relate-context/blob/main/aura_sync.py"
click node_console_api "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/server.py"
click node_routes "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/routes.py"
click node_chat_intents "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/intent_recall.py"
click node_coding_recall "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/coding_recall.py"
click node_recall_client "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/recall_client.py"
click node_query_evidence "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/reuse_evidence.py"
click node_metrics "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/cowork_metrics.py"
click node_topology_ui "https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/Topology.tsx"
click node_topology_model "https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/topology-model.ts"
click node_playground "https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/App.tsx"
click node_query_sources "https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/sources.py"
click node_recall_chyron "https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/RecallChyron.tsx"

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_host_tap,node_turn_capture toneBlue
class node_memory_mcp,node_chat_intents,node_coding_recall,node_recall_client,node_query_evidence toneAmber
class node_capture_api,node_spool,node_collector,node_capture_store,node_local_graphs,node_aura_sync,node_aura,node_console_api,node_routes,node_metrics,node_query_sources toneMint
class node_topology_ui,node_topology_model,node_playground,node_recall_chyron toneRose
class node_agents,node_domain_mcp toneIndigo
```

## Components

### Capture paths

- [Host tap](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/tap.py): `relate_tap/tap.py`
- [Turn capture](https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_graph.py): `memory_graph.py`

### Memory and recall

- [Memory MCP](https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_mcp.py): `memory_mcp.py`
- [Chat intent recall](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/intent_recall.py): `relate_tap/intent_recall.py`
- [Coding recall](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/coding_recall.py): `relate_tap/coding_recall.py`
- [Recall client](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/recall_client.py): `relate_tap/recall_client.py`
- [Query evidence](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/reuse_evidence.py): `relate_tap/reuse_evidence.py`

### Console and storage

- [Capture API](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/routes.py): `relate_tap/routes.py`
- [Capture spool](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/remote_capture.py): `relate_tap/remote_capture.py`
- [Spool collector](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/server.py): `relate_tap/server.py`
- [Capture store](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/store.py): `relate_tap/store.py`
- [Agent Relate graphs](https://github.com/graphadvantage/neo4j-relate-context/blob/main/memory_graph.py): `memory_graph.py`
- [Aura replication](https://github.com/graphadvantage/neo4j-relate-context/blob/main/aura_sync.py): `aura_sync.py`
- **Shared Aura graph**
- [Console API](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/server.py): `relate_tap/server.py`
- [HTTP routes](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/routes.py): `relate_tap/routes.py`
- [Capture and recall metrics](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/cowork_metrics.py): `relate_tap/cowork_metrics.py`
- [Graph query sources](https://github.com/graphadvantage/neo4j-relate-context/blob/main/relate_tap/sources.py): `relate_tap/sources.py`

### Console interface

- [Topology view](https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/Topology.tsx): `frontend/src/Topology.tsx`
- [Topology model](https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/topology-model.ts): `frontend/src/topology-model.ts`
- [Query playground](https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Recall chyron](https://github.com/graphadvantage/neo4j-relate-context/blob/main/frontend/src/RecallChyron.tsx): `frontend/src/RecallChyron.tsx`

### Other components

- **Agents**
- **Domain MCP**

## Connections

- Agents → Host tap: MCP traffic (evidence: `README.md`)
- Host tap → Domain MCP: forwards traffic (evidence: `README.md`)
- Host tap → Capture API: sends redacted copies (evidence: `README.md`)
- Capture API → Capture spool: ingests events (evidence: `relate_tap/routes.py`)
- Capture spool → Spool collector: queues events (evidence: `README.md`)
- Spool collector → Capture store: persists events (evidence: `relate_tap/server.py`)
- Agents → Memory MCP: calls memory tools (evidence: `README.md`)
- Memory MCP → Agent Relate graphs: records turns (evidence: `memory_mcp.py`)
- Agents → Turn capture: reports turns (evidence: `README.md`)
- Turn capture → Agent Relate graphs: stores evidence (evidence: `memory_graph.py`)
- Agent Relate graphs → Aura replication: snapshots graph (evidence: `aura_sync.py`)
- Aura replication → Shared Aura graph: pushes snapshots (evidence: `aura_sync.py`)
- Memory MCP → Recall client: requests recall (evidence: `memory_mcp.py`)
- Recall client → Console API: posts operation (evidence: `relate_tap/recall_client.py`)
- Console API → HTTP routes: registers routes (evidence: `relate_tap/server.py`)
- HTTP routes → Chat intent recall: dispatches recall (evidence: `relate_tap/server.py`)
- HTTP routes → Coding recall: dispatches recall
- Chat intent recall → Query evidence: uses evidence (evidence: `relate_tap/intent_recall.py`)
- Coding recall → Agent Relate graphs: searches turns (evidence: `relate_tap/coding_recall.py`)
- Chat intent recall → Shared Aura graph: promotes intents (evidence: `README.md`)
- Console API → Capture and recall metrics: serves metrics (evidence: `relate_tap/server.py`)
- Topology view → Console API: reads topology (evidence: `README.md`)
- Topology view → Topology model: renders model (evidence: `frontend/src/Topology.tsx`)
- Query playground → Graph query sources: runs queries
- Recall chyron → Topology model: uses recall state (evidence: `frontend/src/RecallChyron.tsx`)
