# padala-varun/memoraeai-1 architecture

> Architecture diagram of the GitHub repository padala-varun/memoraeai-1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/padala-varun/memoraeai-1
- Repository: https://github.com/padala-varun/memoraeai-1

## Overview

MemoraeAI is a persistent-memory service with a web chat and memory browser. A chat message is stored, then processed for extraction and routed into episodic, semantic, profile, or goal memory; later, retrieved memories are assembled into context for a response. Gmail events enter through the webhook and use the same extraction path. The README documents retrieval, forgetting, decay, and email capabilities; their precise internal wiring is not fully shown in the sampled source, so only documented flows are represented.

Main entry points: [`app/main.py`](https://github.com/padala-varun/memoraeai-1/blob/main/app/main.py) (API and Workflow), [`app/memory_router.py`](https://github.com/padala-varun/memoraeai-1/blob/main/app/memory_router.py) (Memory Router), [`app/forgetting.py`](https://github.com/padala-varun/memoraeai-1/blob/main/app/forgetting.py) (Forgetting and Decay), [`app/semantic_pipeline.py`](https://github.com/padala-varun/memoraeai-1/blob/main/app/semantic_pipeline.py) (Semantic Pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_web["Chat and Memories UI<br/>[chat.js]"]
end

subgraph group_orchestration["Memory Orchestration"]
  node_api["API and Workflow<br/>[main.py]"]
  node_conversations["Conversation Service<br/>[user_service.py]"]
  node_retrieval["Memory Retrieval<br/>[main.py]"]
  node_context["Context Builder<br/>[context_builder.py]"]
end

subgraph group_memory["Memory Lifecycle"]
  node_detector["Memory Detection<br/>[memory_detector.py]"]
  node_router["Memory Router<br/>[memory_router.py]"]
  node_episodic["Episodic Pipeline"]
  node_semantic["Semantic Pipeline"]
  node_profilegoals["Profile and Goals"]
  node_forgetting["Forgetting and Decay<br/>[forgetting.py]"]
end

subgraph group_integrations["Stores and Integrations"]
  node_composio["Composio Integration"]
  node_mongo[("MongoDB")]
  node_qdrant[("Qdrant")]
  node_neo4j[("Neo4j")]
end

node_user(("User"))
node_llm{{"Language Model"}}
node_gmail(("Gmail"))

node_user -->|"sends messages"| node_web
node_web -->|"calls API"| node_api
node_api -->|"stores and reads"| node_conversations
node_api -->|"extracts memories"| node_detector
node_detector -->|"requests extraction"| node_llm
node_api -->|"routes results"| node_router
node_router -->|"dispatches episodic"| node_episodic
node_router -->|"dispatches semantic"| node_semantic
node_router -->|"dispatches profile and goals"| node_profilegoals
node_router -.->|"forwards profile facts"| node_semantic
node_episodic -->|"stores and deduplicates"| node_qdrant
node_semantic -->|"resolves fact conflicts"| node_neo4j
node_semantic -->|"stores embeddings"| node_qdrant
node_profilegoals -->|"updates profiles and goals"| node_mongo
node_api -->|"retrieves memories"| node_retrieval
node_retrieval -->|"searches memories"| node_qdrant
node_retrieval -->|"reads relationships"| node_neo4j
node_retrieval -->|"reads profile and goals"| node_mongo
node_api -->|"handles forget requests"| node_forgetting
node_forgetting -->|"removes or invalidates"| node_qdrant
node_forgetting -->|"removes or invalidates"| node_neo4j
node_forgetting -->|"removes or invalidates"| node_mongo
node_api -->|"builds response context"| node_context
node_context -->|"provides context"| node_llm
node_llm -->|"returns response"| node_api
node_gmail -.->|"sends trigger"| node_composio
node_composio -.->|"posts webhook"| node_api
node_api -.->|"processes email content"| node_detector

click node_web "https://github.com/padala-varun/memoraeai-1/blob/main/web/js/chat.js"
click node_api "https://github.com/padala-varun/memoraeai-1/blob/main/app/main.py"
click node_conversations "https://github.com/padala-varun/memoraeai-1/blob/main/app/user_service.py"
click node_detector "https://github.com/padala-varun/memoraeai-1/blob/main/app/memory_detector.py"
click node_router "https://github.com/padala-varun/memoraeai-1/blob/main/app/memory_router.py"
click node_episodic "https://github.com/padala-varun/memoraeai-1/blob/main/app/episodic_pipeline.py"
click node_semantic "https://github.com/padala-varun/memoraeai-1/blob/main/app/semantic_pipeline.py"
click node_profilegoals "https://github.com/padala-varun/memoraeai-1/blob/main/app/profile_goal_pipeline.py"
click node_retrieval "https://github.com/padala-varun/memoraeai-1/blob/main/app/main.py"
click node_context "https://github.com/padala-varun/memoraeai-1/blob/main/app/context_builder.py"
click node_forgetting "https://github.com/padala-varun/memoraeai-1/blob/main/app/forgetting.py"
click node_composio "https://github.com/padala-varun/memoraeai-1/blob/main/app/composio_integration.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_web,node_user toneBlue
class node_api,node_conversations,node_retrieval,node_context toneAmber
class node_detector,node_router,node_episodic,node_semantic,node_profilegoals,node_forgetting toneMint
class node_composio,node_mongo,node_qdrant,node_neo4j toneRose
class node_llm,node_gmail toneIndigo
```

## Components

### User Experience

- [Chat and Memories UI](https://github.com/padala-varun/memoraeai-1/blob/main/web/js/chat.js): `web/js/chat.js`

### Memory Orchestration

- [API and Workflow](https://github.com/padala-varun/memoraeai-1/blob/main/app/main.py): `app/main.py`
- [Conversation Service](https://github.com/padala-varun/memoraeai-1/blob/main/app/user_service.py): `app/user_service.py`
- [Memory Retrieval](https://github.com/padala-varun/memoraeai-1/blob/main/app/main.py): `app/main.py`
- [Context Builder](https://github.com/padala-varun/memoraeai-1/blob/main/app/context_builder.py): `app/context_builder.py`

### Memory Lifecycle

- [Memory Detection](https://github.com/padala-varun/memoraeai-1/blob/main/app/memory_detector.py): `app/memory_detector.py`
- [Memory Router](https://github.com/padala-varun/memoraeai-1/blob/main/app/memory_router.py): `app/memory_router.py`
- [Episodic Pipeline](https://github.com/padala-varun/memoraeai-1/blob/main/app/episodic_pipeline.py): `app/episodic_pipeline.py`
- [Semantic Pipeline](https://github.com/padala-varun/memoraeai-1/blob/main/app/semantic_pipeline.py): `app/semantic_pipeline.py`
- [Profile and Goals](https://github.com/padala-varun/memoraeai-1/blob/main/app/profile_goal_pipeline.py): `app/profile_goal_pipeline.py`
- [Forgetting and Decay](https://github.com/padala-varun/memoraeai-1/blob/main/app/forgetting.py): `app/forgetting.py`

### Stores and Integrations

- [Composio Integration](https://github.com/padala-varun/memoraeai-1/blob/main/app/composio_integration.py): `app/composio_integration.py`
- **MongoDB**
- **Qdrant**
- **Neo4j**

### Other components

- **User**
- **Language Model**
- **Gmail**

## Connections

- User → Chat and Memories UI: sends messages
- Chat and Memories UI → API and Workflow: calls API
- API and Workflow → Conversation Service: stores and reads
- API and Workflow → Memory Detection: extracts memories
- Memory Detection → Language Model: requests extraction
- API and Workflow → Memory Router: routes results
- Memory Router → Episodic Pipeline: dispatches episodic
- Memory Router → Semantic Pipeline: dispatches semantic
- Memory Router → Profile and Goals: dispatches profile and goals
- Memory Router → Semantic Pipeline: forwards profile facts
- Episodic Pipeline → Qdrant: stores and deduplicates
- Semantic Pipeline → Neo4j: resolves fact conflicts
- Semantic Pipeline → Qdrant: stores embeddings
- Profile and Goals → MongoDB: updates profiles and goals
- API and Workflow → Memory Retrieval: retrieves memories
- Memory Retrieval → Qdrant: searches memories
- Memory Retrieval → Neo4j: reads relationships
- Memory Retrieval → MongoDB: reads profile and goals
- API and Workflow → Forgetting and Decay: handles forget requests
- Forgetting and Decay → Qdrant: removes or invalidates
- Forgetting and Decay → Neo4j: removes or invalidates
- Forgetting and Decay → MongoDB: removes or invalidates
- API and Workflow → Context Builder: builds response context
- Context Builder → Language Model: provides context
- Language Model → API and Workflow: returns response
- Gmail → Composio Integration: sends trigger
- Composio Integration → API and Workflow: posts webhook
- API and Workflow → Memory Detection: processes email content
