# inside-734/astrbot_plugin_memora architecture

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

- Interactive diagram: https://gitdiagram.com/inside-734/astrbot_plugin_memora
- Repository: https://github.com/inside-734/astrbot_plugin_memora

## Overview

Memora is an AstrBot long-term memory plugin: conversation material is turned into quality-gated canonical memory, retrieved under session, identity, and privacy constraints, then selectively injected into requests. The graph also covers documented derived knowledge, notes, profiles, reflection, and operational capabilities. The tree and README establish these capability boundaries; sampled source excerpts are partial, so internal wiring not directly evidenced is left out.

Main entry points: [`core/features/memory/infrastructure/atom_store.py`](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/memory/infrastructure/atom_store.py) (Canonical Memory), [`core/features/memory/application/memory_engine.py`](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/memory/application/memory_engine.py) (Memory Engine), [`core/features/recall/application/recall_handler.py`](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/recall/application/recall_handler.py) (Recall Handler), [`core/event_handler.py`](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/event_handler.py) (Event Handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation"]
  node_event_handler["Event Handler<br/>[event_handler.py]"]
  node_conversation_manager["Conversation Manager"]
  node_identity["Identity Resolution<br/>[service.py]"]
  node_reflection["Reflection Handler"]
end

subgraph group_memory["Memory Lifecycle"]
  node_quality_gate["Memory Quality Gate"]
  node_memory_engine["Memory Engine<br/>[memory_engine.py]"]
  node_canonical_store[("Canonical Memory<br/>[atom_store.py]")]
  node_evolution["Memory Evolution"]
end

subgraph group_recall["Recall and Injection"]
  node_retrieval["Hybrid Retrieval"]
  node_recall_handler["Recall Handler<br/>[recall_handler.py]"]
  node_injection["Request Injection<br/>[executor.py]"]
end

subgraph group_derived["Derived Knowledge"]
  node_profiles["User Profiles"]
  node_knowledge["Knowledge Proposals"]
  node_notes["Note Proposals"]
  node_learning["Feedback Learning<br/>[auto_learning.py]"]
end

subgraph group_operations["Operations"]
  node_backup["Backup and Restore<br/>[manager.py]"]
  node_evaluation["Retrieval Evaluation"]
  node_diagnostics["Diagnostics<br/>[health_scorer.py]"]
end

node_astrbot(("AstrBot / User"))

node_astrbot -->|"delivers events"| node_event_handler
node_event_handler -->|"handles conversations"| node_conversation_manager
node_conversation_manager -->|"resolves identity"| node_identity
node_reflection -->|"screens candidates"| node_quality_gate
node_quality_gate -->|"gates writes"| node_memory_engine
node_memory_engine -->|"writes canonical"| node_canonical_store
node_canonical_store -->|"reads canonical"| node_memory_engine
node_memory_engine -->|"supports evolution"| node_evolution
node_recall_handler -->|"requests retrieval"| node_retrieval
node_retrieval -->|"reads memories"| node_canonical_store
node_recall_handler -->|"dispatches injection"| node_injection
node_canonical_store -->|"provides sources"| node_profiles
node_canonical_store -->|"provides sources"| node_knowledge
node_canonical_store -->|"provides sources"| node_notes
node_evaluation -->|"publishes evidence"| node_learning
node_backup -->|"backs up data"| node_canonical_store
node_diagnostics -->|"checks health"| node_canonical_store

click node_event_handler "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/event_handler.py"
click node_conversation_manager "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/conversation/application/conversation_manager.py"
click node_identity "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/identity/application/service.py"
click node_reflection "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/reflection/application/reflection_handler.py"
click node_quality_gate "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/quality/application/memory_quality_gate.py"
click node_memory_engine "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/memory/application/memory_engine.py"
click node_canonical_store "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/memory/infrastructure/atom_store.py"
click node_evolution "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/evolution/application/memory_evolution_manager.py"
click node_retrieval "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/retrieval/hybrid_retriever.py"
click node_recall_handler "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/recall/application/recall_handler.py"
click node_injection "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/injection/application/executor.py"
click node_profiles "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/profiles/application/profile_proposal_pipeline.py"
click node_knowledge "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/knowledge/application/knowledge_proposal_pipeline.py"
click node_notes "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/notes/application/note_proposal_pipeline.py"
click node_learning "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/learning/application/auto_learning.py"
click node_backup "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/backup/application/manager.py"
click node_evaluation "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/evaluation/infrastructure/evaluation_service.py"
click node_diagnostics "https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/diagnostics/application/health_scorer.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_event_handler,node_conversation_manager,node_identity,node_reflection,node_astrbot toneBlue
class node_quality_gate,node_memory_engine,node_canonical_store,node_evolution toneAmber
class node_retrieval,node_recall_handler,node_injection toneMint
class node_profiles,node_knowledge,node_notes,node_learning toneRose
class node_backup,node_evaluation,node_diagnostics toneIndigo
```

## Components

### Conversation

- [Event Handler](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/event_handler.py): `core/event_handler.py`
- [Conversation Manager](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/conversation/application/conversation_manager.py): `core/features/conversation/application/conversation_manager.py`
- [Identity Resolution](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/identity/application/service.py): `core/features/identity/application/service.py`
- [Reflection Handler](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/reflection/application/reflection_handler.py): `core/features/reflection/application/reflection_handler.py`

### Memory Lifecycle

- [Memory Quality Gate](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/quality/application/memory_quality_gate.py): `core/features/quality/application/memory_quality_gate.py`
- [Memory Engine](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/memory/application/memory_engine.py): `core/features/memory/application/memory_engine.py`
- [Canonical Memory](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/memory/infrastructure/atom_store.py): `core/features/memory/infrastructure/atom_store.py`
- [Memory Evolution](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/evolution/application/memory_evolution_manager.py): `core/features/evolution/application/memory_evolution_manager.py`

### Recall and Injection

- [Hybrid Retrieval](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/retrieval/hybrid_retriever.py): `core/features/retrieval/hybrid_retriever.py`
- [Recall Handler](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/recall/application/recall_handler.py): `core/features/recall/application/recall_handler.py`
- [Request Injection](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/injection/application/executor.py): `core/features/injection/application/executor.py`

### Derived Knowledge

- [User Profiles](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/profiles/application/profile_proposal_pipeline.py): `core/features/profiles/application/profile_proposal_pipeline.py`
- [Knowledge Proposals](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/knowledge/application/knowledge_proposal_pipeline.py): `core/features/knowledge/application/knowledge_proposal_pipeline.py`
- [Note Proposals](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/notes/application/note_proposal_pipeline.py): `core/features/notes/application/note_proposal_pipeline.py`
- [Feedback Learning](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/learning/application/auto_learning.py): `core/features/learning/application/auto_learning.py`

### Operations

- [Backup and Restore](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/backup/application/manager.py): `core/features/backup/application/manager.py`
- [Retrieval Evaluation](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/evaluation/infrastructure/evaluation_service.py): `core/features/evaluation/infrastructure/evaluation_service.py`
- [Diagnostics](https://github.com/inside-734/astrbot_plugin_memora/blob/main/core/features/diagnostics/application/health_scorer.py): `core/features/diagnostics/application/health_scorer.py`

### Other components

- **AstrBot / User**

## Connections

- AstrBot / User → Event Handler: delivers events
- Event Handler → Conversation Manager: handles conversations
- Conversation Manager → Identity Resolution: resolves identity
- Reflection Handler → Memory Quality Gate: screens candidates
- Memory Quality Gate → Memory Engine: gates writes
- Memory Engine → Canonical Memory: writes canonical
- Canonical Memory → Memory Engine: reads canonical
- Memory Engine → Memory Evolution: supports evolution
- Recall Handler → Hybrid Retrieval: requests retrieval
- Hybrid Retrieval → Canonical Memory: reads memories
- Recall Handler → Request Injection: dispatches injection
- Canonical Memory → User Profiles: provides sources
- Canonical Memory → Knowledge Proposals: provides sources
- Canonical Memory → Note Proposals: provides sources
- Retrieval Evaluation → Feedback Learning: publishes evidence
- Backup and Restore → Canonical Memory: backs up data
- Diagnostics → Canonical Memory: checks health
